def Test(num,*argv):
print(num)
for i in range(0,len(argv)):
print(argv[i])
print(type(argv))
def Test_2(num,**kargv):
print(type(kargv))
for key,value in kargv.items():
print("{}={}".format(key,value))
Test('Lee','MoKin','Cookies','Biscuit')
Test_2('L',name='LeeMoKin')
最后的输出结果为:
(4Project) PS D:PythonVirtualEnvPythonVirtualEnv_391> & d:/PythonVirtualEnv/PythonVirtualEnv_391/4Project/Scripts/python.exe d:/PythonVirtualEnv/PythonVirtualEnv_391/tmp.py
Lee
MoKin
Cookies
Biscuit
<class 'tuple'>
<class 'dict'>
name=LeeMoKin
<class 'dict'>
通过对类型的判定,最后的输出结果为:
元组和字典;