Python dir() Function

Instance

Show the content of the object:

class Person:
  name = "Bill"
  age = 63
  country = "USA"
print(dir(Person))

Run Example

Definition and Usage

The dir() function returns all properties and methods of the specified object without values.

This function will return all properties and methods, including all default built-in properties of all objects.

Syntax

dir(object)

Parameter Value

Parameter Description
object The object you want to view its valid attributes.