sorting a list of tupples
John Roth
newsgroups at jhrothjr.com
Thu Oct 30 20:05:06 EST 2003
"David Bear" <david.bear at asu.edu> wrote in message
news:m3ptgegrp6.fsf at moroni.pp.asu.edu...
> I have a list of tupples. Each tupple has 3 items. The first item is
> an integer. I'd like to sort the list(of tupples), based on the first
> element of the tupple. I thought about stringifying the tupples, then
sorting
> those, but thought there must be a better way. any idea's?
<list>.sort() should do the job, as long as you want the result
to be a list in ascending order by the value of the first element
of the tuple.
John Roth
>
> --David Bear
> phone: 480-965-8257
> fax: 480-965-9189
> College of Public Programs/ASU
> Wilson Hall 232
> Tempe, AZ 85287-0803
> "Beware the IP portfolio, everyone will be suspect of trespassing"
More information about the Python-list
mailing list