help(function_object)
을 사용하면 주어진 함수에 대해 알고있는 모든 것을 파이썬 형식으로 나타낼 수 있습니다.
inspect.getargspec()
function을 사용하여 허용 된 인수의 개요 튜플 개요를 얻을 수도 있습니다. 당신은뿐만 아니라 파이썬 함수로 그 형식을 inspect.formatargspec()
에 그 함수의 결과를 전달할 수 있습니다 위의 예에서 함수의
>>> from inspect import getargspec, formatargspec
>>> def demo(foo, bar, eggs='ham'): pass
...
>>> getargspec(demo)
ArgSpec(args=['foo', 'bar', 'eggs'], varargs=None, keywords=None, defaults=('ham',))
>>> formatargspec(*getargspec(demo))
"(foo, bar, eggs='ham')"
, help(demo)
인쇄 :
Help on function demo in module __main__:
demo(foo, bar, eggs='ham')
환경이 * nix 인 경우 bpython – thefourtheye
을 사용하십시오. Python에서 함수는 [가변 인수] (http : // stackov erflow.com/questions/919680/python-can-a-variable-number-of-arguments-be-passed-to-function) 이렇게 유용하지 않을 수도 있습니다. –
@thefourtheye [IPython] (http://www.Ipython.org) 아마 더 낫다. –