0

I want to see the arguments of a function in a specific library, example:

import lib

Let's say that lib contains a function func with two arguments: size and date. I want to find a function help such that when I do something like help(lib.func), it gives me something like TWO ARGUMENTS: size and date.

Any suggestions?

AdamElKaroui
  • 81
  • 1
  • 9
  • 1
    Possible duplicate of [How to find out the arity of a method in Python](https://stackoverflow.com/questions/990016/how-to-find-out-the-arity-of-a-method-in-python) – tripleee Dec 12 '18 at 10:59

1 Answers1

4

You need inspect.getfullargspec.

Get the names and default values of a Python function’s parameters. A named tuple is returned:

FullArgSpec(args, varargs, varkw, defaults, kwonlyargs, kwonlydefaults, annotations)

Community
  • 1
  • 1
Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895