## 赋值运算符、逻辑运算符补充

`赋值运算符补充'''增量赋值x=10x+=1''''''交叉赋值a = 10b = 20print(a,b)temp=b # temp=20b=a # b = 10a=temppython一行代码搞定a, b = b, aprint(a,b)''''''链式赋值a=7b=ac=bd=ca = b = c = d = 7print(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]左边变量名的个数与右面包含值的个数相同，多一个不行，少一个也不行x,y,z,a,b=salariesprint(x,y,z,a,b)salaries=[33,44,55,66,77,88,99]x,y,z,*abc=salariesx,y,z会对应列表salaries的前三个值然后*会把剩余的值存放一个列表，然后赋值给abcprint(x,y,z)print(abc)_当变量名，代表该变量值是无用的x,y,z,*_=salaries # 取前三个值print(x,y,z)print(_)salaries=[33,44,55,66,77,88,99]*_,m,n=salaries # 取后两个值print(_)print(m,n)salaries=[33,44,55,66,77,88,99]x,y,z,*_,m=salaries # 取后两个值print(x,y,z)print(m)d={'a':1,'b':2,'c':3}x,y,z=dprint(x,y,z)'''逻辑运算符补充`
`'''一、优先级：not > and > or1、not与紧跟其后的那个条件是不可分割的2、如果条件语句全部由纯and、或纯or链接，按照从左到右的顺序依次计算即可print(True and 10 > 3 and not 4 < 3 and 1 == 1)print(False or 10 < 3 or not 4 < 3 or 1 == 1)3、对于既有and又有or链接的语句，以and为中心把左右两个条件用括号括起来res=(10 == 9 and 0 < 3) or ('' == 'egon' and 0> 3) or not True or ('egon' == 'dsb' and 333 > 100) or 10 > 4print(res)''''''2、短路运算=>偷懒原则所有的数据类型的值都自带布尔值,所以值可以直接被当成条件使用0、None、空三种值对应的布尔值为False，其余全为Trueif 0:    print('ok')else:    print('=====>')if 3 and []:    print('真')else:    print('假')and运算会返回当前计算位置的值res=0 and 123res=111 and 123print(res)if 111 and 123:    print('ok')else:    print('no')    x=''if x:    print('不为空')else:    print("为空")print(1 or 0) # 1print(0 and 2 or 1) # 1print(0 and 2 or 1 or 4) # 1'''`