Перейти к содержанию

Python dir() built-in function

Python dir() built-in function

From the Python 3 documentation Without arguments, return the list of names in the current local scope. With an argument, attempt to return a list of valid attributes for that object.

Examples

>>> dir()
# ['__annotations__', '__builtins__', '__doc__', ...]

>>> dir(1)
# ['__abs__', '__add__', '__and__', '__bool__', ...]

>>> dir('a')
# ['__add__', '__class__', '__contains__', ...]