Notes for Python beginners

Using Python documentation similar to unix man pages

pydoc sys


python -m pydoc sys

For html documentation

pydoc -p 9000

Now server will start running in port 9000. we can access the documentation in http://localhost:9000

To get help while working inside interpreter, type help()


Help prompt will come, now we can type module name to get details about that module.


To list functions/attributes inside a module

import sys

To get it in readable format

import sys
for i in dir(sys):
    print i

To list builtin functions,

import __builtin__
for i in dir(__builtin__):
    print i

To see which are all the modules loaded in our program

import sys
for i in sys.modules:
    print i, ": ", sys.modules[i]

Comments !