Re: Help with multiple key sort

2007-02-06 Thread ian . brady1
Paul already answered it. Tnx Paul. My data is in a file and now I have to take care to strip \t and \n from it. Thanks > I'm not a guru. Maybe that's why I don't understand which "sql-like > sort-by on multiple keys" would produce output that lacks some of the > input but has additional items.

Re: Help with multiple key sort

2007-02-06 Thread Jussi Salmela
[EMAIL PROTECTED] kirjoitti: > gurus: > > I want to implement a sql-like sort-by on multiple keys. I've seen > many examples of just two keys. > > I have a list like this > > 1 one 2 > 1 one 1 > 1 two 1 > 1 one 0 > 1 xx 0 > > result should be like this > > 1 four 2 > 1 one 0 > 1 one 1 > 1 o

Re: Help with multiple key sort

2007-02-06 Thread Paul Rubin
[EMAIL PROTECTED] writes: > It moves right while keeping sorted order to the left. This is the > new stable sort in 2.5. >>> b ['1 one 2', '1 one 1', '1 two 1', '1 one 0', '1 xx 0'] >>> sorted(b,key=lambda x: x.split()) ['1 one 0', '1 one 1', '1 one 2', '1 two 1', '1 xx 0'] -- http://mail.py

Help with multiple key sort

2007-02-06 Thread ian . brady1
gurus: I want to implement a sql-like sort-by on multiple keys. I've seen many examples of just two keys. I have a list like this 1 one 2 1 one 1 1 two 1 1 one 0 1 xx 0 result should be like this 1 four 2 1 one 0 1 one 1 1 one 2 1 xx 0 It moves right while keeping sorted order to the lef