collections.Counter()妙用 将一个键值对添加字典,如('a':1):普通字典:d = {}if 'a' not in d: d['a'] = 1else: d['a'] += 1使用collections.Counter():d = collections.Counter()d['a'] += 1 Other 2023-05-30 214 点赞 3 评论 324 浏览