# -*- coding:utf-8 -*-
import sys
class test_class():
def hello(self):
print(sys._getframe().f_code.co_name)
def hello_world():
print('hello_world!')
print(sys._getframe().f_code.co_name)
if __name__ == '__main__':
ttt = test_class()
ttt.hello()
hello_world()
hello
hello_world!
hello_world
Process finished with exit code 0
---------------------
作者:HeatDeath
来源:CSDN
原文:https://blog.csdn.net/HeatDeath/article/details/72844487
版权声明:本文为作者原创文章,转载请附上博文链接!