PyScripterPython

Python unicode string gotcha

Consider the following executed in python’s 2.7 interactive interpreter: >>> s = u’Ω’>>> se = s.encode(“mbcs”)>>> print s, seΩ Ω>>> s == seTrue>>> print s.lower(), se.lower()ω Ω>>> s.lower() == se.lower()False Bizarre?  Not if you consider…

Read more