Collection的类Counter() 参考:collections模块—— Counter from collections import Counter c = Counter('gallahad') print(c['l']) 输出:2 collections之Counter对象的update方法 参考: