Dir() method in Python Built in Function
Dir method returns the list of attributes which are valid for the object.
Syntax:
dir([object])
Parameter
Dir has only single parameter.
- Object: this is an optional parameter. It attempts to return all the attributes of an object.
Example-1:
class Person:
name = "John"
age = 36
country = "Norway"
print(dir(Person))
Output:
