Converting Unicode to integer

Max M maxm at mxm.dk
Tue Aug 27 05:30:03 EDT 2002


Nikola Plejic wrote:
> Is it possible to convert an Unicode string to an integer? I'm working
> on a program in AnyGUI and it seems to make everything in TextLabels
> an Unicode string, and if I try to add i.e. 2 numbers (let's say 2 and
> 3) I get 23 instead of 5.
> 
> I tried using int() but that doesn't seem to work.

It works for me:

 >>> int(u'21') + 21
42


regards Max M




More information about the Python-list mailing list