![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
编程语言
crazy_matter
这个作者很懒,什么都没留下…
展开
-
Python如何获取当前类方法名称
1、如果是直接写死在函数内可使用: sys._getframe().f_code.co_name 示例: def func1(self): print(sys._getframe().f_code.co_name) 2、单独写成函数,则使用: inspect.stack()[1][3] 示例: def get_func_name(): return inspect.stack()[1][3] class ClassNameA: def func2(self):原创 2020-07-13 17:59:43 · 1553 阅读 · 0 评论 -
php语法杂记
1、__FILE__ 当前php程序的就是完整路径(路径+文件名) 2、dirname(__FILE__) 当前php程序所在的路径(不包括文件名) eg. /Users/didi/Documents/Code/test/testInclude.php $the_full_name=__FILE__; $the_dir=dirname(__FILE__); echo $the原创 2016-10-09 19:41:11 · 169 阅读 · 0 评论