system(command) -> e...">

Is there a "person" for python?

I am wondering if there is a CLI like 'man.py' dedicated to Python?

ex

man.py os.system > system(command) -> exit_status > > Execute the command (a string) in a subshell. 
+8
python
source share
2 answers

The easiest way is to use the pydoc function in the shell, where function is either the built-in name or the qualified name ( module.function ) of the function in the module:

 > PAGER=cat pydoc urllib.urlencode [adrian@hades:~]> PAGER=cat pydoc urllib.urlencode Help on function urlencode in urllib: urllib.urlencode = urlencode(query, doseq=0) Encode a sequence of two-element tuples or dictionary into a URL query string. ... 

( PAGER=cat used only for copying here and here)

When using IPython can you use function? to view docstring function or function?? for a more detailed view, which includes the full source code for functions written in python.

In a regular python shell, you can use help(function) for this. However, in my opinion, the IPython path is more convenient.

+10
source share

The pydoc module provides it:

 $ python -m pydoc os.system Help on built-in function system in os: os.system = system(...) system(command) -> exit_status Execute the command (a string) in a subshell. $ 
+14
source share

All Articles