Reputation: 63
I am trying to print text aligned right containing a german umlaut. This is, what the python interpreter produces:
>>> print "----\n{:>4}\n{:>4}".format("Ho", "Hö")
----
Ho
Hö
so, what am i doing wrong ?
Upvotes: 1
Views: 217
Reputation: 61
Just let python know that you're leading with UTF-8 strings by adding a u
in front of the string literal.
print u"----\n{:>4}\n{:>4}".format("Ho", u"Hö")
Upvotes: 1