How to show the source code of Python module (also in Jupyter)
- using the inspect module
Example: to show the source code for a 'utils' module:
import utils
import inspect
lines = inspect.getsource(utils)
print(lines)
# in Jupyter, use display:
# display(lines)
Comments
Post a Comment