sort accented string
Peter Otten
__peter__ at web.de
Wed Jun 30 09:23:55 EDT 2004
More information about the Python-list mailing list
Wed Jun 30 09:23:55 EDT 2004
- Previous message (by thread): sort accented string
- Next message (by thread): sort accented string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Laurent wrote:
> I'm french and I have a small sorting problem with python (and zope's
Try locale.strcoll():
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "fr_FR")
'fr_FR'
>>> test = list("abéfgz")
>>> test.sort()
>>> test
['a', 'b', 'f', 'g', 'z', '\xe9']
>>> test.sort(locale.strcoll)
>>> test
['a', 'b', '\xe9', 'f', 'g', 'z']
>>>
Peter
- Previous message (by thread): sort accented string
- Next message (by thread): sort accented string
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list