Extract doc strings

Ben Finney ben+python at benfinney.id.au
Thu Jul 1 06:02:59 EDT 2010


moerchendiser2k3 <googler.1.webmaster at spamgourmet.com> writes:

> thanks for your answer. Sure, __doc__ is the access point to the
> docstring, but in this case, I just get the docstring of the code
> object. So an explanation what a code object, but I need the docstring
> of real docstring of the script.

I'm probably not understanding what you're asking, then. If you get the
docstring of the code object, that seems to be what you asked for, no?

The docstring “of the script” might be the docstring of the module. If
that's what you want, you can get the module, then access that module's
‘__doc__’ attribute.

If you don't know how to get the module, then it seems you have a new
question to ask: how to get from (whatever it is you currently have) to
the module. But, not really knowing what it is you're starting with, I
can't say better than that.

-- 
 \        “I took it easy today. I just pretty much layed around in my |
  `\        underwear all day. … Got kicked out of quite a few places, |
_o__)                              though.” —Bug-Eyed Earl, _Red Meat_ |
Ben Finney



More information about the Python-list mailing list