Hello, in which senario do we normaly use this (*args,**kwargs)type of arguments in python.

You use it when you don't know the exact number of arguments.

Simple example ...

def average3(*args):
    """
    don't know the exact number of numeric arguments passed
    prefix * indicates a tuple of variable number of args
    """
    return sum(args)/float(len(args))

print(average3(1, 2, 3, 4, 25))  # 7.0
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.