While inside the Python Interpreter:
What are some ways to learn about the packages I have?
>>> man sys
File "<stdin>", line 1
man sys
^
SyntaxError: invalid syntax
>>> sys --help
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: bad operand type for unary -: '_Helper'
Corrected:
>>> help(sys)
...
Now, how do I see all the packages available to me on my sys.path? And see their subsequent usage and documentation. I know that I can easily download a PDF but all this stuff is already baked in, I'd like to not duplicate files.
Thanks!
You can look at help("modules"), it displays the list of available modules.
To explore a particular module/class/function use dir and __doc__:
>>> import sys
>>> sys.__doc__
"This module ..."
>>> dir(sys)
[..., 'setprofile', ...]
>>> print(sys.setprofile.__doc__)
setprofile(function)
Set the profiling function. It will be called on each function call
and return. See the profiler chapter in the library manual.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With