Python之解包

#解包(一个变多个)

names=("AAA","BBB","CCC","DDD","EEE")

print("未解包",names)

print("解包后",*names)#用*将元组解包

def fun5(XX,YY,ZZ):

    print(XX,YY,ZZ)

scores={"XX":66,"YY":77,"ZZ":88}

fun5(**scores)#用**将字典解包

你可能感兴趣的:(python)