python程序获取当前行号和文件名

来源:互联网 发布:怎么把产品放到淘宝上 编辑:程序博客网 时间:2024/04/26 14:05

print "======" + __file__ + "===================" + str(sys._getframe().f_lineno)



def test_fun():
print sys._getframe().f_code.co_name  

0 0