On Nov 12, 1:07 am, Davy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a dictionary with n elements, and I want to get the m(m<=n)
> keys with the largest values.
>
> For example, I have dic that includes n=4 elements, I want m=2 keys
> have the largest values)
> dic = {0:4,3:1,5:2,7:8}
> So, the
On Nov 12, 1:07 am, Davy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a dictionary with n elements, and I want to get the m(m<=n)
> keys with the largest values.
>
> For example, I have dic that includes n=4 elements, I want m=2 keys
> have the largest values)
> dic = {0:4,3:1,5:2,7:8}
> So, the
On Nov 12, 8:54 pm, Jeff <[EMAIL PROTECTED]> 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}
Jeff <[EMAIL PROTECTED]> wrote:
> Why are you doing that with key-value pairs? Why not with the array
> module or lists?
>
The original poster asked about a problem with key-value pairs. I just
answered his question.
--
http://mail.python.org/mailman/listinfo/python-list
Why are you doing that with key-value pairs? Why not with the array
module or lists?
--
http://mail.python.org/mailman/listinfo/python-list
Davy <[EMAIL PROTECTED]> wrote:
> For example, I have dic that includes n=4 elements, I want m=2 keys
> have the largest values)
> dic = {0:4,3:1,5:2,7:8}
> So, the the largest values are [8,4], so the keys are [7,0].
>
> Is there any fast way to implement this algorithm?
> Any suggestions are we
On Nov 12, 10:07 am, Davy <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have a dictionary with n elements, and I want to get the m(m<=n)
> keys with the largest values.
>
> For example, I have dic that includes n=4 elements, I want m=2 keys
> have the largest values)
> dic = {0:4,3:1,5:2,7:8}
> So, th
Hi all,
I have a dictionary with n elements, and I want to get the m(m<=n)
keys with the largest values.
For example, I have dic that includes n=4 elements, I want m=2 keys
have the largest values)
dic = {0:4,3:1,5:2,7:8}
So, the the largest values are [8,4], so the keys are [7,0].
Is there any