for I in [] or [1,2,3] 这种用法你肯定没见过吧

1. [] or [1,2,3]

 for i in [] or [1,2,3]:
    print(i)

将会输出1,2,3

2.[1,2,3] or []

 for i in [1,2,3] or []
    print(i)

将会输出1,2,3

3.[1,2,3] and []

for i in [1,2,3] and []:
    print(i)

将会输出空值

4.[4,5,6] or [1,2,3]

for i in [4,5,6] or [1,2,3]:
print(i)

将会输出4,5,6

5.[4,5,6] and [1,2,3]

for i in [4,5,6] and [1,2,3]:
    print(i)

将会输出1,2,3

你可能感兴趣的:(Python)