python *args, **kwargs

sh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC58eVE6F5OedOYE3nf8JFQX2WXgHe43gNtNd63nWViTRBBX+fgZ1w3Fdj+RFYccCnLz460vCDD7ZVqyRPkDl5EjWt0ZE4jtOBOLIaHguZrB+DR+zP++WkuAJWgAMv65+sYG8vKHaa//pyQFfbn9ZBHbKgwN4ZlLljow64RO/i2uZ8sNmxXUWE7nXXkS9vBf7jXsIz8pALOe5yVMjyDmhiR77udD2Lo+A88bXjvRaf5lWQJvoP7NSIdF9ZZxRlliRm0Tm0RvSI4lvDFf4Fa/ZsBi1VS9+58dogHvdx+1JIebyYwpzLs/V2jR/UKcsJ/O5lGyrDgCngccyyan+Faxxu9 lg@lg-MRC-WX0

def foo(x,*args, **kwargs):
    print(x)
    print ('args = ', args)
    print(type(args))
    print ('kwargs = ', kwargs)
    print(type(kwargs))
    
    
foo(1,2,3,4, a=1,b=2,c=3)

1
args =  (2, 3, 4)

kwargs =  {'a': 1, 'b': 2, 'c': 3}

def foo(x,*a, **b):
    print(x)
    print ('args = ', a)
    print(type(a))
    print ('kwargs = ', b)
    print(type(b))
foo(1,2,3,4, a=1,b=2,c=3)
1
args =  (2, 3, 4)

kwargs =  {'a': 1, 'b': 2, 'c': 3}

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