[Tutor] To print docstrings

prasad rao prasadaraon50 at gmail.com
Thu Dec 4 15:46:04 CET 2008


Hello  friends.
 I am new to programing.I am learning Python.
I failed in my attempts to retrive doc strings of methods in
a module.
"""
for x in dir(logging):
 print x,x.__doc__
 =============
for x in dir(collections):
 print x,collections.x.__doc__
==================

>>> def dd(o):
 zx=dir (o)
 for x in zx:
  ax=o+x
  print ax.__doc__


>>> dd(collections)

================

def dd(o):
 zx=dir (o)
 for x in zx:
  ax=str(o)+x

  print ax.__doc__


>>>
>>> dd(collections)

"""

Above snippets of code generates str.__doc__ for every iteration.

Please someone tell me how I can retrive all the docstrings

ina module

thanks in advance

 Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20081204/f317e6f4/attachment.htm>


More information about the Tutor mailing list