python 常用技巧 — 字典 (dictionary)

目录:

1. python 相加字典所有的键值 (python sum all values in dictionary)

 

内容:

1. python 相加字典所有的键值 (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. 

 

猜你喜欢

转载自www.cnblogs.com/ttweixiao-IT-program/p/11905348.html