优先级 ()>not>and>or
x or y.若X为真返回X,X为假则返回Y
print(1 or 2) #1
print(0 or 2) #2
x and y 与 or 相返
print(1 and 2) #2
print(0 and 2) #0
print(1>2 and 3 or 4 and 3<2) # flase
print(2 or 1<3) #2
print(2 or 1<3 and 2) #2
本文共 261 字,大约阅读时间需要 1 分钟。
优先级 ()>not>and>or
x or y.若X为真返回X,X为假则返回Y
print(1 or 2) #1
print(0 or 2) #2
x and y 与 or 相返
print(1 and 2) #2
print(0 and 2) #0
print(1>2 and 3 or 4 and 3<2) # flase
print(2 or 1<3) #2
print(2 or 1<3 and 2) #2
转载于:https://www.cnblogs.com/ychihior/p/10798911.html