0
What does the function dir() do
Please, explain with an example
1 Antwort
+ 2
dir(x) will return a list of methods of x. Whether x is a module that you can import, or a class, using print(dir(itertools)) (for example) will print a list of methods within that module or class. print(dir(list)) will give you class methods you can do with lists.