oops, sorry. I meant l1=[(date,v1,v2,v3), ...] l2=[ another set of tuples ]
Thanks. so I have to concat the multiple lists first(all of them are sorted already) ? Alex Martelli wrote: > I'm not sure what "my list is a tuple" mean (list and tuple being > different types) nor what this has to do with the recipe. Anyway... > sequences are compared lexicographically -- first items first, then > second items if the first items are equal, and so on. So, if you have a > list X whose items tuples and want X sorted on the tuples' first items, > X.sort() will suffice -- if the tuples never have equal first-items, or > if you're OK with second-items getting compared when the first-items are > equal. If you want to sort on first-items ONLY, leaving the tuples in > the same order in the list when their first-items are equal: > > import operator > X.sort(key=operator.itemgetter(0)) > > > Alex -- http://mail.python.org/mailman/listinfo/python-list