mrd*_*y34 3 python json diacritics decoding
我的"Theres loads of adventures to be had here;\nYou'll get your own Kobémon\nand get to catch more!".JSON 文件中有一个这样的字符串 ( ),当我从它读取到 python 文件和 Tkinter 文本框时,我得到"é"而不是é. 有没有办法阻止这种情况。我使用这个阅读 .JSON :(self.Lines = json.load(open("Data/Lines.json")))
尝试这个:
(self.Lines = json.load(open("Data/Lines.json","rb"), encoding="utf-8"))
区别在于以字节为单位加载文件并以utf-8格式读取它(假设这是文件格式)。
| 归档时间: |
|
| 查看次数: |
1596 次 |
| 最近记录: |