dir()
` function in Python is used to find out what attributes a module or object has. It returns a list of strings that represent the names of the attributes of the object or module. Here is an example program that demonstrates the use of `dir()
` function :import math
# Get the list of attributes of the math module
attr_list = dir(math)
# Print the attributes
for attr in attr_list:
print(attr)
math
` module and used the `dir()
` function to get the list of attributes of the `math
` module. We have then printed the list of attributes using a for loop. This program will output a list of attributes of the `math
` module, such as `pi
`, `sqrt
`, `log
`, etc.dir()
` function can also be used to get the list of attributes of an object. For example, if we have an object `my_object
`, we can get the list of its attributes using the `dir(my_object)
` function call.