python *args,**kwargs

def test_kwargs(name, age, *args, **kwargs):
    print(name)
    print(age)

    print(args)
    print(kwargs)


if __name__ == "__main__":

    print("*name && **kwargs")
    test_kwargs("allen", "10", "this is another args", company="sina", email="[email protected]")
    print("test *name and **kwargs end\n\n")

output

*name && **kwargs
allen
10
('this is another args',)
{'company': 'sina', 'email': '[email protected]'}
test *name and **kwargs end

你可能感兴趣的:(python *args,**kwargs)