Unicode, stdout, and stderr

Lele Gaifax lele at metapensiero.it
Tue Jul 22 03:38:51 EDT 2014


Peter Otten <__peter__ at web.de> writes:

> No, both print to stdout, but just
>
>>>> x
>
> is passed to the display hook of the interactive interpreter. This applies 
> repr() and  then tries to print the result. If this fails it makes another 
> effort, roughly (the actual code is written in C)
>
> sys.stdout.buffer.write(repr(x).encode(
>     sys.stdout.encoding, "backslashreplace"))

Ah-moment!

Thanks,
ciao, lele.
-- 
nickname: Lele Gaifax | Quando vivrò di quello che ho pensato ieri
real: Emanuele Gaifas | comincerò ad aver paura di chi mi copia.
lele at metapensiero.it  |                 -- Fortunato Depero, 1929.




More information about the Python-list mailing list