# conding:utf8

# *args 代表可以输入多个参数
def test(*args):
return args

# *loc 解包,解元祖的包, list不能解包,list的值使用循环取值
def main(loc):
print(*loc)

# **kwargs 代表输入多个键值对参数
def func(**kwargs):
return kwargs

s = test('hello', 'world', ['xiao', 'ming'])
print(s)
# ('hello', 'world', ['xiao', 'ming'])

main(s)
# hello world ['xiao', 'ming'] 解包,解元祖的包, list不能解包,list的值使用循环取值

f = func(test='xiaoming')
print(f)
# {'test': 'xiaoming'}

相关文章:

  • 2021-04-28
  • 2022-12-23
  • 2021-11-19
  • 2021-10-25
  • 2021-10-03
  • 2021-04-29
  • 2021-10-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案