In follow-up: I think this should work:
# -*- coding: utf8 -*-
import locale
locale.setlocale( locale.LC_ALL, "" )
class Test(object):
def __init__(self,nam):
self.name = nam
def __cmp__(self, other):
return cmp(self.name, other.name)
l = [ Test("ABILENE.ttf"), Test("Årgate.ttf"), Test("årse.ttf"),
Test("Ärt.ttf"), Test("MomentGothic.ttf"), Test("öggi.ttf"),
Test("Öhmygawd.ttf")]
l.sort( cmp=locale.strcoll, key=lambda obj:obj.name )
for i in l: print i.name
Any bugs?
\d
--
http://mail.python.org/mailman/listinfo/python-list