[EMAIL PROTECTED] wrote:

> However how can I change it so it works with a string variable?
>
> print unicode("\u221E") doesn't seem to do it.

Sure, that's because \u only works in unicode strings. You'd need
to "encode" your \u-containing string to a unicode string. Perhaps
this'll help:

>>> def to_unicode(num):
...     character = "\\u"+num
...     return character.decode("unicode-escape")
... 
>>> to_unicode("221E")
u'\u221e'
>>> print to_unicode("221E")
∞

(improvements welcome)

Regards,


Björn

-- 
BOFH excuse #273:

The cord jumped over and hit the power switch.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to