Create Unicode object problem

Irmen de Jong irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Fri Feb 6 12:18:47 CET 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