Python: Counter import collections c = collections.Counter() print 'Initial :', c c.update('abcdaab...

Please Visit: http://ift.tt/1ajReyV

Python: Counter
import collections

c = collections.Counter()
print 'Initial :', c

c.update('abcdaab')
print 'Sequence:', c

c.update({'a':1, 'd':5})
print 'Dict :', c
The count values are increased based on the new data, rather than replaced.
http://ift.tt/1HW1xR0


from Public RSS-Feed of Jeffery yuan. Created with the PIXELMECHANICS 'GPlusRSS-Webtool' at http://gplusrss.com http://ift.tt/1Z0wUOA
via LifeLong Community

No comments:

Post a Comment