How to decode a UTF-8-encoded byte string in Python
文章推薦指數: 80 %
Call bytes.decode(encoding) with encoding as "utf8" to decode a UTF-8-encoded byte string bytes .
延伸文章資訊
- 1Python3 bytes.decode()方法 - 菜鸟教程
Python3 bytes.decode()方法Python3 字符串描述decode() 方法以指定的编码格式解码bytes 对象。默认编码为'utf-8'。 语法decode()方法语法: ...
- 2How to decode a UTF-8-encoded byte string in Python
Call bytes.decode(encoding) with encoding as "utf8" to decode a UTF-8-encoded byte string bytes .
- 3Python String encode() decode() - DigitalOcean
- 4Python Strings decode() method - GeeksforGeeks
- 5Python 的編碼
with open('text.txt', 'r') as f: b_str = f.read() print b_str.decode('utf-8') # 自行判斷標準輸出編碼 print ...