开发者

Printing docstrings in Python 3

How do you print doc strings in python 3.1.开发者_如何学Pythonx?

I tried with the re and sys modules as a test and I keep getting errors. Thanks

import re
print(re._doc_)
Traceback (most recent call last):
  File "<pyshell#91>", line 1, in <module>
    print(re._doc_)
AttributeError: 'module' object has no attribute '_doc_'


It's called __doc__, not _doc_.

import re
print(re.__doc__)

Works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜