python_解包
2020-12-13 03:25
标签:framework word int name versions doc bsp 集合 格式 1、解包直接把这个元组,list,集合按顺序进行传参,当然字符串也是可以的传参,只要不是key=value的格式都可以 2、字典方式解包 python_解包 标签:framework word int name versions doc bsp 集合 格式 原文地址:https://www.cnblogs.com/xiaokuangnvhai/p/11074634.html#解包--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)
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
上一篇:线程的几种状态