How can I check source code of a module in Jupyter notebook?
Question:
For example, I want to check the source code of a python library, directly in the notebook, is there a way to do that?
Thank you
Answers:
Type the fully qualified function name, then type ??
.
You can use inspect module (which is built in) – for example you can see the tree module below from scikit-learn.
import inspect
from sklearn import tree
inspect.getsourcelines(tree.tree)
For example, I want to check the source code of a python library, directly in the notebook, is there a way to do that?
Thank you
Type the fully qualified function name, then type ??
.
You can use inspect module (which is built in) – for example you can see the tree module below from scikit-learn.
import inspect
from sklearn import tree
inspect.getsourcelines(tree.tree)