Increase value in hash table

Chris Rebert clp2 at rebertia.com
Wed Jan 23 02:34:56 EST 2013


On Jan 22, 2013 11:31 PM, "moonhkt" <moonhkt at gmail.com> wrote:
>
> Hi Al
>
> I have Data file have below
>
> Data file
> V1
> V2
> V3
> V4
> V4
> V3
>
> How to using count number of data ?
>
> Output
> V1 = 1
> V2 = 1
> V3 =2
> V4 = 2

Construct a frequency table using collections.Counter:

http://docs.python.org/2.7/library/collections.html#collections.Counter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130122/1ec720a8/attachment.html>


More information about the Python-list mailing list