Increase value in hash table

moonhkt moonhkt at gmail.com
Wed Jan 23 08:26:45 CET 2013


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



# Global Veriable
printque = {}
in def have below

printque[val] =  printque[val] + 1

I have below error
  File "xprintlogchk.py", line 78, in chklog
    printque[val] =  printque[val] + 1
KeyError: 'nan'




More information about the Python-list mailing list