标签:python 链式 补充 运算符 int python入门 入门 个数 aries
a=10
b=20
print(a,b)
a,b=b,a
print(a,b)
a=7
b=a
c=b
d=c
print(a,b,c,d)
a=b=c=d=7
print(a,b,c,d)
# salaries=[33,44,55,66,77]
# x=salaries[0]
# y=salaries[1]
# z=salaries[2]
# a=salaries[3]
# b=salaries[4]
# print(x,y,z,a,b)
# 左边变量名的个数与右边包含值的个数相同,多一个不行,少一个不行
# x,y,z,a,b=salaries
# print(x,y,z,a,b)
salaries=[33,44,55,66,77,88,99]
'''
x,y,z,*abc=salaries
x,y,z会对应salaries列表的前三个值
然后*会把剩余的值存放一个列表,然后赋值给abc
print(x,y,z)
print(abc)
'''
# _当变量名,代表该变量值是无用的
# 取前三个值
# x,y,z,*_=salaries
# print(x,y,z)
# print(_)
# 取后两个值
# *_,m,n=salaries
# print(m,n)
x,y,z*_,m,n=salaries
print(x,y,z)
print(m,n)
标签:python 链式 补充 运算符 int python入门 入门 个数 aries
原文地址:https://www.cnblogs.com/guanxiying/p/12344632.html