I have a dictionary with { 'utf8 char' : number }. pprint() would treat the utf8 as a byte array and output hex values. Is it possible to tell it to print it as string so that the console can render UTF8 text?
Asked
Active
Viewed 858 times
2
-
*The `pprint` module provides a capability to “pretty-print” arbitrary Python data structures in a form which can be used as input to the interpreter.* – Blender Jun 05 '13 at 06:11
-
@Blender are you saying it's impossible? – lang2 Jun 05 '13 at 07:35
-
3It is possible. Google to the rescue! http://stackoverflow.com/questions/10883399/unable-to-encode-decode-pprint-output – kirelagin Jun 05 '13 at 07:37
-
@lang2: That's what the default `pprint` module does. You'd have to change some stuff in order for it to work. – Blender Jun 05 '13 at 12:41