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. Thanksimport 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.
精彩评论