the official way of printing unicode strings

Marc 'BlackJack' Rintsch bj_666 at
Sun Dec 14 10:25:27 CET 2008

On Sun, 14 Dec 2008 06:48:19 +0100, Piotr Sobolewski wrote:

> Then I tried to do this that way:
> sys.stdout = codecs.getwriter("utf-8")(sys.__stdout__)
> s = u"Stanisław Lem"
> print u
> This works but is even more combersome.
> So, my question is: what is the official, recommended Python way?

I'd make that first line:

sys.stdout = codecs.getwriter('utf-8')(sys.stdout)

Why is it even more cumbersome to execute that line *once* instead 
encoding at every ``print`` statement?

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list