相关疑难解决方法(0)

python 获取函数中参数的变量名

我想做这样的事情:

fib = 1
foo = (arg):
    print arg, argName # the name of the variable that was put in for arg
foo(fib)
Run Code Online (Sandbox Code Playgroud)

并得到这个返回:

1, fib
Run Code Online (Sandbox Code Playgroud)

python

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

python ×1