Answers for "how to check arguments of a function in python"

10

python arguments

import sys

print ("the script has the name %s" % (sys.argv[0])
Posted by: Guest on November-18-2019
0

python get number of arguments of a function

from inspect import signature

def someMethod(self, arg1, kwarg1=None):
    pass

sig = signature(someMethod)
print(len(sig.parameters))  # 3
Posted by: Guest on July-04-2021

Code answers related to "how to check arguments of a function in python"

Python Answers by Framework

Browse Popular Code Answers by Language