Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / devtools / v9 / html / python / lib / module-pydoc.html
CommitLineData
920dae64
AT
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<html>
3<head>
4<link rel="STYLESHEET" href="lib.css" type='text/css' />
5<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
6<link rel='start' href='../index.html' title='Python Documentation Index' />
7<link rel="first" href="lib.html" title='Python Library Reference' />
8<link rel='contents' href='contents.html' title="Contents" />
9<link rel='index' href='genindex.html' title='Index' />
10<link rel='last' href='about.html' title='About this document...' />
11<link rel='help' href='about.html' title='About this document...' />
12<link rel="next" href="module-doctest.html" />
13<link rel="prev" href="misc.html" />
14<link rel="parent" href="misc.html" />
15<link rel="next" href="module-doctest.html" />
16<meta name='aesop' content='information' />
17<title>5.1 pydoc -- Documentation generator and online help system</title>
18</head>
19<body>
20<DIV CLASS="navigation">
21<div id='top-navigation-panel' xml:id='top-navigation-panel'>
22<table align="center" width="100%" cellpadding="0" cellspacing="2">
23<tr>
24<td class='online-navigation'><a rel="prev" title="5. Miscellaneous Services"
25 href="misc.html"><img src='../icons/previous.png'
26 border='0' height='32' alt='Previous Page' width='32' /></A></td>
27<td class='online-navigation'><a rel="parent" title="5. Miscellaneous Services"
28 href="misc.html"><img src='../icons/up.png'
29 border='0' height='32' alt='Up One Level' width='32' /></A></td>
30<td class='online-navigation'><a rel="next" title="5.2 doctest "
31 href="module-doctest.html"><img src='../icons/next.png'
32 border='0' height='32' alt='Next Page' width='32' /></A></td>
33<td align="center" width="100%">Python Library Reference</td>
34<td class='online-navigation'><a rel="contents" title="Table of Contents"
35 href="contents.html"><img src='../icons/contents.png'
36 border='0' height='32' alt='Contents' width='32' /></A></td>
37<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
38 border='0' height='32' alt='Module Index' width='32' /></a></td>
39<td class='online-navigation'><a rel="index" title="Index"
40 href="genindex.html"><img src='../icons/index.png'
41 border='0' height='32' alt='Index' width='32' /></A></td>
42</tr></table>
43<div class='online-navigation'>
44<b class="navlabel">Previous:</b>
45<a class="sectref" rel="prev" href="misc.html">5. Miscellaneous Services</A>
46<b class="navlabel">Up:</b>
47<a class="sectref" rel="parent" href="misc.html">5. Miscellaneous Services</A>
48<b class="navlabel">Next:</b>
49<a class="sectref" rel="next" href="module-doctest.html">5.2 doctest </A>
50</div>
51<hr /></div>
52</DIV>
53<!--End of Navigation Panel-->
54
55<H1><A NAME="SECTION007100000000000000000">
565.1 <tt class="module">pydoc</tt> --
57 Documentation generator and online help system</A>
58</H1>
59
60<P>
61<A NAME="module-pydoc"></A>
62
63<P>
64
65<span class="versionnote">New in version 2.1.</span>
66
67<a id='l2h-1059' xml:id='l2h-1059'></a>
68
69<P>
70The <tt class="module">pydoc</tt> module automatically generates documentation from
71Python modules. The documentation can be presented as pages of text
72on the console, served to a Web browser, or saved to HTML files.
73
74<P>
75The built-in function <tt class="function">help()</tt> invokes the online help system
76in the interactive interpreter, which uses <tt class="module">pydoc</tt> to generate
77its documentation as text on the console. The same text documentation
78can also be viewed from outside the Python interpreter by running
79<b class="program">pydoc</b> as a script at the operating system's command prompt.
80For example, running
81
82<P>
83<div class="verbatim"><pre>
84pydoc sys
85</pre></div>
86
87<P>
88at a shell prompt will display documentation on the <tt class="module"><a href="module-sys.html">sys</a></tt>
89module, in a style similar to the manual pages shown by the <span class="Unix">Unix</span>
90<b class="program">man</b> command. The argument to <b class="program">pydoc</b> can be the name
91of a function, module, or package, or a dotted reference to a class,
92method, or function within a module or module in a package. If the
93argument to <b class="program">pydoc</b> looks like a path (that is, it contains the
94path separator for your operating system, such as a slash in <span class="Unix">Unix</span>),
95and refers to an existing Python source file, then documentation is
96produced for that file.
97
98<P>
99Specifying a <b class="programopt">-w</b> flag before the argument will cause HTML
100documentation to be written out to a file in the current directory,
101instead of displaying text on the console.
102
103<P>
104Specifying a <b class="programopt">-k</b> flag before the argument will search the
105synopsis lines of all available modules for the keyword given as the
106argument, again in a manner similar to the <span class="Unix">Unix</span> <b class="program">man</b>
107command. The synopsis line of a module is the first line of its
108documentation string.
109
110<P>
111You can also use <b class="program">pydoc</b> to start an HTTP server on the local
112machine that will serve documentation to visiting Web browsers.
113<b class="program">pydoc</b> <b class="programopt">-p 1234</b> will start a HTTP server on port
1141234, allowing you to browse the documentation at
115<code>http://localhost:1234/</code> in your preferred Web browser.
116<b class="program">pydoc</b> <b class="programopt">-g</b> will start the server and additionally
117bring up a small <tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt>-based graphical interface to help
118you search for documentation pages.
119
120<P>
121When <b class="program">pydoc</b> generates documentation, it uses the current
122environment and path to locate modules. Thus, invoking
123<b class="program">pydoc</b> <b class="programopt">spam</b> documents precisely the version of
124the module you would get if you started the Python interpreter and
125typed "<tt class="samp">import spam</tt>".
126
127<P>
128Module docs for core modules are assumed to reside in
129<a class="url" href="http://www.python.org/doc/current/lib/">http://www.python.org/doc/current/lib/</a>. This can be overridden by
130setting the <a class="envvar" id='l2h-1060' xml:id='l2h-1060'>PYTHONDOCS</a> environment variable to a different URL or
131to a local directory containing the Library Reference Manual pages.
132
133<DIV CLASS="navigation">
134<div class='online-navigation'>
135<p></p><hr />
136<table align="center" width="100%" cellpadding="0" cellspacing="2">
137<tr>
138<td class='online-navigation'><a rel="prev" title="5. Miscellaneous Services"
139 href="misc.html"><img src='../icons/previous.png'
140 border='0' height='32' alt='Previous Page' width='32' /></A></td>
141<td class='online-navigation'><a rel="parent" title="5. Miscellaneous Services"
142 href="misc.html"><img src='../icons/up.png'
143 border='0' height='32' alt='Up One Level' width='32' /></A></td>
144<td class='online-navigation'><a rel="next" title="5.2 doctest "
145 href="module-doctest.html"><img src='../icons/next.png'
146 border='0' height='32' alt='Next Page' width='32' /></A></td>
147<td align="center" width="100%">Python Library Reference</td>
148<td class='online-navigation'><a rel="contents" title="Table of Contents"
149 href="contents.html"><img src='../icons/contents.png'
150 border='0' height='32' alt='Contents' width='32' /></A></td>
151<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
152 border='0' height='32' alt='Module Index' width='32' /></a></td>
153<td class='online-navigation'><a rel="index" title="Index"
154 href="genindex.html"><img src='../icons/index.png'
155 border='0' height='32' alt='Index' width='32' /></A></td>
156</tr></table>
157<div class='online-navigation'>
158<b class="navlabel">Previous:</b>
159<a class="sectref" rel="prev" href="misc.html">5. Miscellaneous Services</A>
160<b class="navlabel">Up:</b>
161<a class="sectref" rel="parent" href="misc.html">5. Miscellaneous Services</A>
162<b class="navlabel">Next:</b>
163<a class="sectref" rel="next" href="module-doctest.html">5.2 doctest </A>
164</div>
165</div>
166<hr />
167<span class="release-info">Release 2.4.2, documentation updated on 28 September 2005.</span>
168</DIV>
169<!--End of Navigation Panel-->
170<ADDRESS>
171See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
172</ADDRESS>
173</BODY>
174</HTML>