When I use .lower()
in Python 2.7, string is not converted to lowercase for letters ŠČŽ
.
I read data from dictionary.
I tried using str(tt["code"]).lower()
, tt["code"].lower()
.
Any suggestions ?
When I use .lower()
in Python 2.7, string is not converted to lowercase for letters ŠČŽ
.
I read data from dictionary.
I tried using str(tt["code"]).lower()
, tt["code"].lower()
.
Any suggestions ?
Use unicode strings:
See that little
u
? That means that it's created as aunicode
object rather than astr
object.Use unicode:
You need to convert your text to unicode as soon as it enters your programme from the outside world, rather than merely at the point at which you notice an issue.
Accordingly, either use the
codecs
module to read in decoded text, or use'bytestring'.decode('latin2')
(where in place of latin2 you should use whatever the actual encoding is).