Created
December 24, 2014 07:08
-
-
Save xuechong87/5e08c3bb025a1d1f52b3 to your computer and use it in GitHub Desktop.
python 获取方法名
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
import inspect | |
class Test1(): | |
@staticmethod | |
def printMethodName (): | |
print( "method:" + inspect.stack()[1][3] + "\n") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment