【发布时间】:2019-04-29 09:01:09
【问题描述】:
我在 pandas 中遇到逻辑运算符问题。 如果我尝试:
list1=['x','y']
if st1=='A' & str2 not in list1: #do stuff
我明白了:
unsupported operand type(s) for &: 'str' and 'bool'", u'occurred at index 0
但这有效:为什么?
if st1=='A' and str2 not in list1: #do stuff
我所做的只是将 & 改为 and。
【问题讨论】:
-
你可能想要
st1 == 'A' not the=` -
对不起,这是我做的...错误仍然存在。