Last active
March 12, 2016 08:44
-
-
Save MOOOWOOO/1aaeb9632183d08e298b 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 sys | |
def get_cur_info(): | |
_ = sys._getframe() | |
return (_.f_code.co_name, _.f_back.f_lineno) # funcname, lineno |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment