Is there is a tool similar to dir() for modules that will tell me what parameters a given function takes? For instance, I would like to do something like dir(os.rename) and have it tell me what parameters are documented so that I can avoid checking the documentation online, and instead use only the Python scripting interface to do this.
Asked
Active
Viewed 4,945 times
7
2 Answers
12
I realize that you're more interested in help(thing) or thing.__doc__, but if you're trying to do programmatic introspection (instead of human-readable documentation) to find out about calling a function, then you can use the inspect module, as discussed in this question.
Community
- 1
- 1
Josh Kelley
- 52,449
- 19
- 137
- 227
4
help(thing) pretty prints all the docstrings that are in the module, method, whatever ...
nate c
- 8,374
- 2
- 25
- 26