当前位置: 代码迷 >> 综合 >> python中将bytes列表换成str列表
  详细解决方案

python中将bytes列表换成str列表

热度:32   发布时间:2024-03-09 08:51:25.0
  •  python中将bytes列表换成str列表
#python中将bytes列表换成str列表
bytes_list = [b'68', b'49', b'36', b'70', b'06', b'16', b'04', b'68', b'91', b'0c', b'33', b'33', b'34', b'34', b'87', b'49', b'34', b'33', b'4a', b'5b', b'43', b'53', b'bc', b'16'] str_list = [x.decode('utf-8') for x in bytes_list]
print(str_list)#输出
str_list = ['68', '49', '36', '70', '06', '16', '04', '68', '91', '0c', '33', '33', '34', '34', '87', '49', '34', '33', '4a', '5b', '43', '53', 'bc', '16']

#python读取DL/T 645-2007协议电表时碰到小问题。

 

  相关解决方案