[Tutor] To print docstrings

Kent Johnson kent37 at tds.net
Thu Dec 4 16:17:50 CET 2008


On Thu, Dec 4, 2008 at 9:46 AM, prasad rao <prasadaraon50 at gmail.com> wrote:
>
> 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__

Here x is a string, that is why you print out str.__doc__. Try this:
  print x, getattr(logging, x).__doc__

or, just
  help(logging)

Kent


More information about the Tutor mailing list