prasad rao 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__
 =============
for x in dir(collections):
 print x,collections.x.__doc__
==================

I am not sure what you are aiming for. If you just want to collect them for reading, http://docs.python.org/library/ is much easier.

If you want to produce documentation of your own modules, you may want to take a look at pydoc or epydoc.


If you want to collect the doc strings just for the sake of it, add them in a list instead of printing:

docs = []
for x in dir(collections):
   docs.append(x.__doc__)

or in one line:  docs = [x.__doc__ for x in dir(collections)]


if you want to make a single (possibly long string of text from that list, join the strings together as in

text = "\n".join(docs)


or all in one line (with a generator to suppress creation of the intermediate list):

text = "\n".join(x.__doc__ for x in dir(collections))

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


I have no idea what you are doing with 'ax' here.
You seem to be adding a module and one of its functions and assign the result to ax, an operation I don't understand.

If it is important for you, could you please provide some explanation of what you trying to do here?


Sincerely,
Albert
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to