On 02:02 pm, mr.spoo...@gmail.com wrote:
Hi, I'm trying to use logical operators (or, and) with the "in" statement, but I'm having some problems to understand their behavior.
"and" and "or" have no particular interaction with "in".
In [1]: l = ['3', 'no3', 'b3'] In [2]: '3' in l Out[2]: True In [3]: '3' and '4' in l Out[3]: False In [4]: '3' and 'no3' in l Out[4]: True This seems to work as I expected.
What this actually does is '3' and ('no3' in l). So it might have produced the result you expected, but it didn't work how you expected. :)
Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list