Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Sunday, August 14, 2011

Python Documentation

If you installed Python along with documentation. Here is the command to get the list of modules and its functionalities(docs).

pydoc -p <port_number>

Now you can view the documentation with the help of browser by entering the URL as "http://localhost:<port_number>/" the port_number is the number which is mentioned in the command

Example: pydoc -p 8080

For the above command documentation is avail in "http://localhost:8080/" address.

Friday, January 28, 2011

creating and running a python file

create a python file:

vi file_name.py

the extension of python file is .py
to check python libraries are installed on your system, type python in shell, this will shows the version and options in python.

example:
vi hello.py

the above command will create a python file with file name as hello.

running python scripts:

python file_name.py

the above command will run the python scripts.

example:

>vi hello.py
print("Hello world!")

>python hello.py
output:Hello world!

First hello world program in python

syntax:
print("message")

example:
print("Hello world!!")