How to get a set of keys with largest values?

Davy zhushenli at gmail.com
Mon Nov 12 20:36:21 EST 2007


On Nov 12, 8:54 pm, Jeff <jeffo... at gmail.com> wrote:
> Why are you doing that with key-value pairs?  Why not with the array
> module or lists?

Hi,

The original question is a bit complex. I have to implement a sparse
matrix which use a dict of dict implementation.
For example, sp_mat = {1:{2:1,3:4},2:{4:6,8:9}}.

And I want to get m key with the largest values in each row? Any good
ideas?

Best regards,
Davy




More information about the Python-list mailing list