【发布时间】:2015-02-23 09:44:21
【问题描述】:
我想将带有 UTF-8 字符串的字典写入文件。我看到another 线程关于使用 pprint 打印 utf-8 字符串,并尝试像这样修改那里看到的代码
MyPrettyPrinter().pprint(dict, stream=f)
但它不起作用。我对 python 中的类没有经验,所以我不知道在 pprint 库中重新定义什么。
【问题讨论】:
-
对不起,我错过了你的链接,我看不清楚,或者这里的超链接不够亮
标签: python file utf-8 stream pprint