# -*- 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?utm_source=copy