为什么我不能在我的条件下使用字符串比较?我正在使用 Python。
myjson = 字典列表
if myjson[row]['languages'] == '' | myjson[row]['languages'] == 'english': pass
else: gen_dict['languages'].append(myjson[row]['languages'])
错误:
Traceback (most recent call last):
File "/private/var/folders/jv/9_sy0bn10mbdft1bk9t14qz40000gn/T/Cleanup At Startup/gc_all_del_dup.txt-395854237.266.py", line 157, in <module>
gen_nondup(f_l)
File "/private/var/folders/jv/9_sy0bn10mbdft1bk9t14qz40000gn/T/Cleanup At Startup/gc_all_del_dup.txt-395854237.266.py", line 132, in gen_nondup
if myjson[row]['languages'] == '' | myjson[row]['languages'] == 'english': pass
TypeError: unsupported operand type(s) for |: 'str' and 'str'