Create Unicode object problem

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Fri Feb 6 06:18:47 EST 2004


Kathy wrote:
> Is there any way I can create a unicode object from the unicode code
> itself.
> I extract the code from a file and need to create a unicode object
> that represents the corresponding character.
> 
> So what i get from reading my file is a string containing for example
> the code 'u8c79' (Chinese character).

 >>> unichr(eval('u8c79'.replace('u','0x')))
u'\u8c79'


--irmen



More information about the Python-list mailing list