bwilk_97 at yahoo.com
Sun Apr 9 00:11:58 CEST 2000
<<<For example, say that I have the following tabular data: [(2,1,"REC02"),
<<<(1,3,"REC03"),(3,1,"REC01")], and I want to obtain: [(1,3,"REC03"),
<<<(2,1,"REC02"),(3,1,"REC01")], that is, the tabular data should be
<<<sorted on the first and then the second column.
You can get lists.py from:
It has this routine, which is attributed to Guido and others.
nlist = map( lambda x,indices=indices:
map( lambda i,x=x: x[i], indices) + [x],
return map( lambda l: l[-1], nlist)
The list in not sorted in place though.
<<<By the way, should I represent rows by tuples or by embedded lists?
They need to be lists if you want to edit them... In my opinion, a list of
dictionaries is the best way to go.....
<<<Another problem: to visually represent/edit tabular data, I need an
<<<editable grid widget (with possibly comboboxes as cell editors).
<<<TkInter does not seem to have an appropriate grid widget.
wxPython has a grid that is ok... There is a new grid that will be available
soon that will be a bit better.
More information about the Python-list