Multiplying all the values in a dictionary

Felipe Almeida Lessa felipe.lessa at gmail.com
Thu Mar 23 20:15:07 EST 2006


Em Sex, 2006-03-24 às 11:04 +1000, John McMonagle escreveu:
> Is there a better/faster/cleaner way to achieve this ?

Maybe...

for key in d:
	d[key] = [x*2 for x in d[key]]

...?

I can't thing of anything better :(...


HTH,

-- 
Felipe.




More information about the Python-list mailing list