Re: [Tutor] Fw: utf locale sorting

2009-09-18 Thread Igor Mavrović - ma...@irb
Excellent, the thing works! Thanx a lot! - Original Message - From: Kent Johnson To: Igor Mavrović - ma...@irb Cc: Rich Lovely ; tutor@python.org Sent: Wednesday, September 16, 2009 7:06 PM Subject: Re: [Tutor] Fw: utf locale sorting How about this (assuming both

Re: [Tutor] Fw: utf locale sorting

2009-09-16 Thread Kent Johnson
On Wed, Sep 16, 2009 at 11:45 AM, Igor Mavrović - ma...@irb wrote: > Sorry Kent, I should have put it in the original message... > This is the way I call the sorted function: > >   # resultSet looks like: [[("DN", {"":["", ...], ...})], ...] > >   resultSetSortedByCn = sorted(resultSet, key=lambda

Re: [Tutor] Fw: utf locale sorting

2009-09-16 Thread Igor Mavrović - ma...@irb
rted(words, key=lambda o: locale.strxfrm(o[0])) can't work 'cause strxfrm's argument must be a string, not a tuple... What do you think? Igor - Original Message - From: Rich Lovely To: Igor Mavrović - ma...@irb Cc: tutor@python.org Sent: Wednesday, September 16, 2009 4

Re: [Tutor] Fw: utf locale sorting

2009-09-16 Thread Rich Lovely
2009/9/16 Igor Mavrović - ma...@irb : > Hi, > > I know about the use of locale module: > import locale locale.setlocale(locale.LC_ALL, "hr_HR.UTF8") print sorted(words, key=locale.strxfrm) > > but I have specific and complicated data structure (list of lists containing > strings, tup

Re: [Tutor] Fw: utf locale sorting

2009-09-16 Thread Kent Johnson
On Wed, Sep 16, 2009 at 9:51 AM, Igor Mavrović - ma...@irb wrote: > Hi, > > I know about the use of locale module: > import locale locale.setlocale(locale.LC_ALL, "hr_HR.UTF8") print sorted(words, key=locale.strxfrm) > > but I have specific and complicated data structure (list of li

[Tutor] Fw: utf locale sorting

2009-09-16 Thread Igor Mavrović - ma...@irb
Hi, I know about the use of locale module: import locale locale.setlocale(locale.LC_ALL, "hr_HR.UTF8") print sorted(words, key=locale.strxfrm) but I have specific and complicated data structure (list of lists containing strings, tuples and dictionaries) due to LDAP search result data. So I u