tabular data
Bill Wilkinson
bwilk_97 at yahoo.com
Sat Apr 8 18:11:58 EDT 2000
More information about the Python-list mailing list
Sat Apr 8 18:11:58 EDT 2000
- Previous message (by thread): Merchant Empires - python CGI based game up on SourceForge
- Next message (by thread): tabular data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
<<<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: http://starship.python.net/crew/lemburg/ It has this routine, which is attributed to Guido and others. def sortedby(list,*indices): nlist = map( lambda x,indices=indices: map( lambda i,x=x: x[i], indices) + [x], list) nlist.sort() 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.
- Previous message (by thread): Merchant Empires - python CGI based game up on SourceForge
- Next message (by thread): tabular data
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list