float to unicode question
gabor
gabor at z10n.net
Wed Feb 12 12:15:12 EST 2003
hi,
this works:
a = str(14.34)
this works:
a = unicode(14.34)
this doesn't work:
a = unicode(14.34,'iso-8859-1')
why?
i have to do:
a = unicode(string(14.34),'iso-8859-1')
of course there is no sense in specifying an encoding for a float
number, but in my program i'm dealing with all kind of data, not just
numbers, so i have to do:
a = unicode(str(something),'iso-8859-1'),
because i don't know what type something is.
the question is why does it work to convert a float to unicode without
specifying the codepage, but it fails when codepage specified?
thanks,
gabor
More information about the Python-list
mailing list