0

《Fluent Python》 读书笔记:文本和字节序列

 2 years ago
source link: https://www.lfhacks.com/tech/python-fluent-text-byte/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

《Fluent Python》 读书笔记:文本和字节序列

发布日期 2021-12-31
最后修改 2022-01-14
阅读 1 分钟
阅读量 113
1443.jpg
扫一扫,转发文章 python-fluent-text-byte.png

Python2 的噩梦:UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xxx in position 0: illegal multibyte sequence

  • 从 Python3 的 str 对象中取出的是 Unicode 字符
  • 从 Python2 的 unicode 对象中取出的是 Unicode 字符
  • 从 Python2 的 str 对象中取出的是 原始字节序列

Unicode

Unicode 对字符的标识,称为 code point,码位。

码位的范围从 \x0 到 \x10FFFF,共 1,114,112 个。前缀 U+

cc-by-nc.gif

若无特别说明,本站文章均为原创,并采用 署名协议 CC-BY-NC 授权。
欢迎转载,惟请保留原文链接,且不得用于商业用途。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK