Created
January 23, 2015 16:51
-
-
Save WilliamQLiu/506530b03526b0c98e47 to your computer and use it in GitHub Desktop.
Python See Docstring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How to view the docstring of a function quickly | |
# https://www.python.org/dev/peps/pep-0257/ | |
### View the docstring of a function | |
$print repr(foo.__doc__) # e.g. print repr(matplotlib.pyplot.plt.__doc__) | |
### Split the lines | |
$foo.__doc__.splitlines() # e.g. matplotlib.pyplot.plt.__doc__.splitlines() | |
### Trim any unnecessary lines - basically do this for best formatting | |
$trim(foo.__doc__) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment