Extract doc strings
Jean-Michel Pichavant
jeanmichel at sequans.com
Thu Jul 1 05:35:50 EDT 2010
moerchendiser2k3 wrote:
> Hi all,
>
> when I have a PyCodeObject, is there any way to extract a doc string
> from the code?
> For instance the following script
>
> <---script---->
> """
> Hello World!
> """
> def main():
> pass
> main()
> </---script--->
>
> I would like to get "Hello World!". Any chance? Thanks in advance!!
>
> Bye, moerchendiser2k3
>
Hello,
"""Hello world!!"""
import sys
def main():
print sys.modules[__name__].__doc__
main()
JM
More information about the Python-list
mailing list