+ 1
How we can read only the comments of any module?
4 Respostas
+ 7
from math import sqrt
help(sqrt)
print(sqrt.__doc__)
+ 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))
+ 2
Wait a sec Mert Yazici, that only prints the docstrings not the comments right? Correct me if I am wrong.
+ 2
hmmm didn't know about that. Thank you.