python common technique - dictionaries (dictionary)

table of Contents:

1. python dictionary by adding all the keys (python sum all values ​​in dictionary)

 

content:

1. python dictionary by adding all the keys (python sum all values ​​in dictionary)

https://stackoverflow.com/questions/4880960/how-to-sum-all-the-values-in-a-dictionary

d = {'a':1, 'b':2, 'c':4}
sum(d.values())
7

 

2. 

 

Guess you like

Origin www.cnblogs.com/ttweixiao-IT-program/p/11905348.html