John Sampson wrote:
> I notice that the string method 'lower' seems to convert some strings (input
> from a text file) to Unicode but not others.
> This messes up sorting if it is used on arguments of 'sorted' since Unicode
> strings come before ordinary ones.

I doubt that. Can you provide a short example?

> Is there a better way of case-insensitive sorting of strings in a list? Is it
> necessary to convert strings read from a plaintext file
> to Unicode? If so, how? This is Python 2.7.8.

Well, if you have non-ASCII chars for many Unicode characters str.lower()
won't give reasonable results. So binary strings containing an encoding of
Unicode character entities should be decoded to Unicode strings first.

Ciao, Michael.

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to