티스토리 뷰

728x90
import inspect

arg_keys = inspect.getfullargspec({method})[0]

 

>>> def foo(a, b, c=4, *arglist, **keywords): pass
>>> inspect.getfullargspec(foo)
(['a', 'b', 'c'], 'arglist', 'keywords', (4,))

https://stackoverflow.com/questions/218616/how-to-get-method-parameter-names

 

How to get method parameter names?

Given the Python function: def a_method(arg1, arg2): pass How can I extract the number and names of the arguments. I.e., given that I have a reference to func, I want the func.[something] to ...

stackoverflow.com

728x90
댓글