Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #84354
| Date | 2015-01-23 17:00 +0000 |
|---|---|
| From | John Sampson <jrs.idx@ntlworld.com> |
| Subject | Case-insensitive sorting of strings (Python newbie) |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.18040.1422032384.18130.python-list@python.org> (permalink) |
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. 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. Regards John Sampson
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Case-insensitive sorting of strings (Python newbie) John Sampson <jrs.idx@ntlworld.com> - 2015-01-23 17:00 +0000 Re: Case-insensitive sorting of strings (Python newbie) Michael Ströder <michael@stroeder.com> - 2015-01-23 18:10 +0100 Re: Case-insensitive sorting of strings (Python newbie) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-24 04:56 +1100
csiph-web