问题一
-
python2
python2.x 中,b 前缀没有具体的意义,只是为了兼容 python3.x 的写法 -
python3
python3.x 中,默认的str
是 pyhton2.x 中的 unicode
python2.x 中的str
是 bytes
问题二
- unicode 转 bytes
data.encode('utf-8')
- bytes 转unicode
str(b",'utf-8')
问题一
python2
python2.x 中,b 前缀没有具体的意义,只是为了兼容 python3.x 的写法
python3
python3.x 中,默认的 str
是 pyhton2.x 中的 unicode
python2.x 中的 str
是 bytes
问题二
data.encode('utf-8')
str(b",'utf-8')