Python DocStrings

Python has a nifty feature called documentation strings which is commonly mentioned by its shorter name docstrings. We can even get back the docstring from, let say a function, when the program is actually running! 

def  sayHello():
         ”’This function prints Hello”’
         print “Hello”

print sayHello()
print sayHello.__doc__ 


  This function prints Hello

To write the documentation of sys:

import pydoc


note the sys.html is written in the same path.


One Response to Python DocStrings

  1. girish says:

    watch which has simmillar topic video clippings

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: