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 51 点赞 0 评论 77 浏览