This is a post
Pydoc can be used to access the doc for python modules or classes easily. We will show the basic command for the pydoc.
Show help for pydoc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26pydoc -h
pydoc - the Python documentation tool
pydoc <name> ...
Show text documentation on something. <name> may be the name of a
Python keyword, topic, function, module, or package, or a dotted
reference to a class or function within a module or module in a
package. If <name> contains a '/', it is used as the path to a
Python source file to document. If name is 'keywords', 'topics',
or 'modules', a listing of these things is displayed.
pydoc -k <keyword>
Search for a keyword in the synopsis lines of all available modules.
pydoc -p <port>
Start an HTTP server on the given port on the local machine. Port
number 0 can be used to get an arbitrary unused port.
pydoc -g
Pop up a graphical interface for finding and serving documentation.
pydoc -w <name> ...
Write out the HTML documentation for a module to a file in the current
directory. If <name> contains a '/', it is treated as a filename; if
it names a directory, documentation is written for all the contents.Show document for a python module.
1
2
3
4
5
6
7
8
9python -m pydoc pow
Help on built-in function pow in module __builtin__:
pow(...)
pow(x, y[, z]) -> number
With two arguments, equivalent to x**y. With three arguments,
equivalent to (x**y) % z, but may be more efficient (e.g. for longs).Search python modules with specific keyword
1
2
3
4
5
6
7
8# Find python modules which name contains "json"
python -m pydoc -k json
json - JSON (JavaScript Object Notation) <http://json.org> is a subset of
json.decoder - Implementation of JSONDecoder
json.encoder - Implementation of JSONEncoder
json.scanner - JSON token scanner
json.testsStart an HTTP server for pydoc on the given port
1
2python -m pydoc -p 4000
# Open the browser and visit "http://localhost:4000" to view the documents for all your local python modules.
Start an HTTP server for pydoc on a free port
1
python -m pydoc -g
Write out the HTML documentation for a module
1
2python -m pydoc -w json
# We will get json.html in current folder.