On Sat, 13 Aug 2005, Jim Roush wrote:
> I have a python script that creates a list of lists like so:
>
> Quant.append( [ db_ticker, stock_close, MTD, 0, QTD, 0, YTD, 0, 0, 0 ] )
>
> After Quant is created, I want to sort it by MTD. If I use a simple
> Quant.sort(), I assume its going to sort by 'db_ticker' which is not
> what I want.
>
> I've been trying to figure out how to use the cmp() in a list sort
> method and I have failed to understand.
Hi Jim,
AMK has written a nice mini-tutorial on how to use a list's sort()
effectively:
http://www.amk.ca/python/howto/sorting/sorting.html
Does his tutorial make sense, or are there parts in there that are
baffling? Please feel free to ask questions on it, and we'll try to help.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor