0
When I want to use a module and hit dir(module) and get a list of names... how can I find out what they do?
You import something and use dir() and get a massive list of names. For example. I want to use androidhelper which is a module qpython offers for android. I can import this module but have no idea what all the methods do and or how to use them. How can I do this?? And for this specific module androidhelper help() doesnt work since it's not listed on the python website. I'm very new so any help regarding this would be greatly appreciated.
1 Réponse
+ 2
>>> help(dir)
dir(...)
dir([object]) -> list of strings
If called without an argument, return the names in the current scope.
Else, return an alphabetized list of names comprising (some of) the attributes of the given object, and of attributes reachable from it.
If the object supplies a method named __dir__, it will be used; otherwise the default dir() logic is used and returns:
for a module object: the module's attributes.
for a class object: its attributes, and recursively the attributes of its bases.
for any other object: its attributes, its class's attributes, and recursively the attributes of its class's base classes.