五殳师兄

关注

python 获取当前运行的 class 和 方法的名字

五殳师兄

关注

阅读 108

2022-08-23

# coding=utf-8

import sys
class Hello():

def hello(self):
print('the name of method is ## {} ##'.format(sys._getframe().f_code.co_name))
print('the name of class is ## {} ##'.format(self.__class__.__name__))

if __name__ == "__main__":
h = Hello()
h.hello()

  



相关推荐

小沙坨

python获取当前运行程序的名字

小沙坨 133 0 0

q松_松q

Python获取当前运行函数的名称、类方法名称

q松_松q 136 0 0

李雨喵

python获取当前文件夹名字

李雨喵 85 0 0

微笑沉默

python之if __name__ == “__main__”详解 || python获取当前运行程序的类名和方法名 || python获取当前程序运行程序的模块名

微笑沉默 104 0 0

Raow1

struts2拦截器中获取action的名字和方法的名字

Raow1 128 0 0

杰森wang

Android获取当前运行的App进程

杰森wang 71 0 0

c一段旅程c

JS获取当前时间的方法

c一段旅程c 51 0 0

梦幻之云

Java:SpringBoot获取当前运行的环境activeProfile

梦幻之云 23 0 0

狗啃月亮_Rachel

[AHK]获取当前运行脚本的pid

狗啃月亮_Rachel 54 0 0

爱喝酒的幸福人

【JS】获取当前时间的简便方法

爱喝酒的幸福人 47 0 0

精彩评论(0)

0 0 举报