PyDocs

Nav

Data Types

Counter.update

  • Counter.update(**kwargs)
  • Counter.update(iterable, /, **kwargs)
  • Counter.update(mapping, /, **kwargs)
Like dict.update() but add counts instead of replacing them.

Source can be an iterable, a dictionary, or another Counter instance.

>>> c = Counter('which')
>>> c.update('witch')           # add elements from another iterable
>>> d = Counter('watch')
>>> c.update(d)                 # add elements from another counter
>>> c['h']                      # four 'h' in which, witch, and watch
4
0 Examples
No examples for collections/Counter.update.
See Also
No see-alsos for collections/Counter.update
0 Notes
No notes for Counter.update