Created
November 3, 2016 16:15
-
-
Save rlabbe/866da87194253de5f3bab817467a8879 to your computer and use it in GitHub Desktop.
Print source without docstring
This file contains hidden or 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
from inspect import getsource | |
import re | |
def psource(fun): | |
print(re.sub('""".*"""', '', getsource(fun), flags=re.DOTALL)) | |
#example | |
from somewhere import foo | |
psource(foo) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment