【问题标题】:Unsupported operand types for &: 'str' and 'bytes' in python [duplicate]& 不支持的操作数类型:python 中的“str”和“bytes”[重复]
【发布时间】:2018-11-12 08:23:27
【问题描述】:
if(msg.topic == "abc" & msg.payload == b'1'):
     print("Loop entered")


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

【问题讨论】:

标签: python string python-3.x


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-08-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-12-24
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多