标签:framework word int name versions doc bsp 集合 格式
1、解包直接把这个元组,list,集合按顺序进行传参,当然字符串也是可以的传参,只要不是key=value的格式都可以
#解包--list,元组,集合 def connect(ip,port,username,password): print(ip) print(port) print(username) print(password) info_list=[‘192.168.1.1‘,3309,‘zhaozhao‘,‘123456‘] info_tuple=(‘192.168.1.1‘,3309,‘zhaozhao‘,‘123456‘) info_set={‘192.168.1.1‘,3309,‘zhaozhao‘,‘123456‘} connect(*info_list) connect(*info_tuple) connect(*info_set)
2、字典方式解包
dic={"name":"zhaozhao","password":"123456"} def dic_fun(name,password): print(name) print(password) dic_fun(**dic) /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 /Users/dongyf/Documents/python/besttest_study/test.py zhaozhao 123456
标签:framework word int name versions doc bsp 集合 格式
原文地址:https://www.cnblogs.com/xiaokuangnvhai/p/11074634.html