9
有沒有辦法找出一個python函數的位置參數的名稱?通過內省查找位置參數的名稱
def foo(arg1, arg2):
pass
f=foo
# How do I find out want the 1st argument to f is called? I want 'arg1' as an answer
有沒有辦法找出一個python函數的位置參數的名稱?通過內省查找位置參數的名稱
def foo(arg1, arg2):
pass
f=foo
# How do I find out want the 1st argument to f is called? I want 'arg1' as an answer
功能inspect.getargspec()
做你在Python 2
需要的東西在Python 3,這已被棄用,而應改用signature
。