python kwargs传递多个参数
def my_sum(my_integers):result = 0for x in my_integers:result += xreturn resultlist_of_integers = [1, 2, 3]print(my_sum(list_of_integers))def concatenate(**kwargs):result = ""# Iterating over the Pyth
·
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'))
更多推荐
已为社区贡献8条内容
所有评论(0)