+ 1

How we can read only the comments of any module?

12th Jul 2018, 4:41 PM
Maninder $ingh
Maninder $ingh - avatar
4 Antworten
+ 7
from math import sqrt help(sqrt) print(sqrt.__doc__)
12th Jul 2018, 4:44 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 4
S. C. yes only docstrings but you can read source with inspect module (not for builtins) import inspect print(inspect.getsource(function_or_module_name))
12th Jul 2018, 5:48 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 2
Wait a sec Mert Yazici, that only prints the docstrings not the comments right? Correct me if I am wrong.
12th Jul 2018, 5:37 PM
Satyam
+ 2
hmmm didn't know about that. Thank you.
12th Jul 2018, 6:06 PM
Satyam