What is PYDOC

Python Blog






How to use PYDOC

#Author: ManishHacker1


Hello everyone, Today my article is about Pydoc. Pydoc is a Python Documentation Tool which help we can search everything about Python Liabrary.


What is pydoc?



pydoc - the Python documentation tool

pydoc.py ...
Show text documentation on something. 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 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.py -k
Search for a keyword in the synopsis lines of all available modules.

pydoc.py -p
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.py -g
Pop up a graphical interface for finding and serving documentation.

pydoc.py -w ...
Write out the HTML documentation for a module to a file in the current
directory. If contains a '\', it is treated as a filename; if
it names a directory, documentation is written for all the contents.span>



How to Start:


You can use pydoc to search through the Python libraries installed on your system. At the command prompt type the following:



First open command prompt and go to your PATH where our pydoc.py is place.


C:\Users\hacked>cd\ and Hit Enter
C:\>cd Python27 and Hit Enter
C:\Python27\>cd Lib and Hit Enter
C:\Python27\Lib\>python pydoc.py -g and Hit Enter




Ok, Now you will see a pop up window which the following will appear:



Click on the open browser button then your browser will automatically start with the python document.
If you get an error and if you don't find your python document. .


Please check Tkinter package is installed in your system or not, If you have not this package in your system, then pydoc -g will return an error, since the graphics window that it opens requires Tkinter. An alternative is to start the web server directly:


C:\Users\hacked>cd\ and Hit Enter
C:\>cd Python27 and Hit Enter
C:\Python27\>cd Lib and Hit Enter
C:\Python27\Lib\>python pydoc.py -p 7464


This starts the pydoc web server on port 7464. Now point your web browser at::


http://localhost:7464



and you will be able to browse the Python libraries installed on your system. Use this approach to start pydoc and take a look at the math module.








Follow ManishHacker1



Follow ManishHacker1




Comments

Popular posts from this blog

How to create Folder Lock with Password Protected using Python

TOP 10 ANIMATED BATCH FILE PROGRAM

How to Connect Window Machine to Linux Machine Using Python via SSH