About •  Blogs •  Apps •  Contact me

Notes for Python beginners

Added on 21st Jul, 2010 by Aravinda, Tags: python

Using Python documentation similar to unix man pages


pydoc sys

or


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()

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


sys

To list functions/attributes inside a module


import sys
dir(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]

Books/documentation

  1. Dive into Python and Dive into Python3
  2. Byte of Python
  3. [Python documentation](http://docs.python.org/]
  4. Python for beginners
   Tweet this!
0 comments

Add Comments

I am on:  Twitter •  github •  Flickr •  Facebook •  Linked In •  Google profile •  Sampada