开发者

Printing docstrings in Python 3

开发者 https://www.devze.com 2023-03-03 21:43 出处:网络
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

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

精彩评论

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