&amp ;:' str'不支持的操作数类型和'字节'在python中

时间:2018-06-02 10:59:37

标签: python string python-3.x

if(msg.topic == "abc" & msg.payload == b'1'):
     print("Loop entered")


TypeEror: unsupported operand types for &: 'str' and 'bytes'

1 个答案:

答案 0 :(得分:0)

and是我们在Python中编写连词的方式,所以:

if msg.topic == "abc" and msg.payload == b'1':