As far as I know, the in
operator in Python can't be chained or at least I couldn't find any info on it, here is my problem
Here is the code
arr = [1, True, 'a', 2]
print('a' in arr in arr) # prints False
print(('a' in arr) in arr) # prints True
What I don't understand is the first print, I know in the second the first in
returns True
and then it check if True
is in arr
, but what about the first one? Does it check if 'a'
is in arr
and then if arr
is in arr
?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…