Sub-sort after sort

Andrew Koenig ark at acm.org
Fri Nov 2 18:36:58 EDT 2007


<keeftm at gmail.com> wrote in message 
news:1194039935.380959.254770 at i13g2000prf.googlegroups.com...

> I would want to sort by name first, then sub sort by location. Any
> ideas? Thanks!

In Python 2.3 and later, sorting is stable -- so you can sort successively 
in reverse order.  In other words, sort the list by location, then sort the 
sorted result again by name and you should get what you want.





More information about the Python-list mailing list