The dir() function returns a list of variables, methods, and types defined in the current scope.
Example
#!/usr/bin/python3
# -*- coding: UTF-8 -*-
print(dir())
Output:
['__annotations__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__']
Syntax
dir([object])
Parameters
Name | Description |
object | The object of which dir() attempts to return all attributes |
Return Value
The dir() function returns a list of valid attributes of the object.