Skip to content
Built-in Functions

dir()

List an object's available attribute names.

dir(object=None)

dir() is a quick discovery tool. It returns names that you may be able to read, call, or otherwise use on an object.

Parameters

NameDescription
objectOptional object to inspect. Without one, it lists names in the current scope.

Returns

A sorted list of attribute names.

Try it

Run it and change it
class Book:
    title = "Python"
print("title" in dir(Book))

Related entries