python kwargs传递多个参数

def my_sum(my_integers):
    result = 0
    for x in my_integers:
        result += x
    return result
 
list_of_integers = [1, 2, 3]
print(my_sum(list_of_integers))
def concatenate(**kwargs):
    result = ""
    # Iterating over the Python kwargs dictionary
    for arg in kwargs.values():
        result += arg
    return result
 
print(concatenate(a="Real", b="Python", c="Is", d="Great", e="!"))


def get(kwargs):
	kwargs = kwargs.get('key')
	print(kwargs)
print(get('key':'ok','key2':'false'))


猜你喜欢

转载自blog.csdn.net/qq_16792139/article/details/120134189
今日推荐