有没有办法从函数中识别函数名?

2024-10-06 14:00:34 发布

您现在位置:Python中文网/ 问答频道 /正文

有没有办法从函数中找到函数名

def some_function():
    function_name = ... # some way of retrieving the name 'some_function'
    print(function_name)

function_name的预期值是字符串:“some_函数”


Tags: ofthe函数字符串namedeffunctionsome