Displaying Unicode Chars

gregpinero at gmail.com gregpinero at gmail.com
Sun Feb 10 15:39:29 EST 2008


I want to make a little Python utility where a user can enter the
unicode numerical code and get the actual symbol back in utf-8.

For example, a user could enter something like u221E

And get back ∞

Now, this does seem to work:

>>> print u"\u221E"
∞
However how can I change it so it works with a string variable?

print unicode("\u221E") doesn't seem to do it.

I hope this makes sense.  I don't know all the unicode terminology to
phrase this question coherently ;-)

Thanks in advance,

Greg



More information about the Python-list mailing list