python字符串str与byte字节相等==判断
if __name__ == '__main__':
bb = b'zhangphil' # byte类型数据
print(bb)
print(type(bb))
ss = r'zhangphil'
print(bb == ss)
print(str(bb, encoding='utf-8') == ss)
print(str(bb) == ss)
print(bb == bytes(ss, encoding='utf-8'))
输出:
b'zhangphil'
<class 'bytes'>
False
True
False
True