python中bytes类型不一定是utf-8,还可能是gbk等其他类型
程序员文章站
2022-06-14 15:22:37
...
以下两个都对
# -*- coding: utf-8 -*-
b = bytes('asd',encoding='gbk')
# ret = b.decode('u')
print(b)
# -*- coding: utf-8 -*-
b = bytes('asd',encoding='utf-8')
# ret = b.decode('u')
print(b)