Multiplying all the values in a dictionary
John McMonagle
johnmc at velseis.com.au
Thu Mar 23 20:04:58 EST 2006
Say I have a dictionary like below:
d = {(100,500):[5,5], (100,501):[6,6], (100,502):[7,7]}
Say I want to multiply all the values of the dictionary by 2:
for key in d.keys():
d[key] = map(lambda x: x*2, d.get(key))
Is there a better/faster/cleaner way to achieve this ?
Thanks,
John
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
More information about the Python-list
mailing list