Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
UTF-8 文字列を含む辞書をファイルに書き込みたいと考えています。pprint で utf-8 文字列を出力することに関する別のスレッドを見て、そこに表示されているコードを次のように変更しようとしました
MyPrettyPrinter().pprint(dict, stream=f)
しかし、それは機能していません。私はPythonのクラスの経験がないので、pprintライブラリで何を再定義すればよいかわかりません。
そのはず:
MyPrettyPrinter(stream=f).pprint(d)