Increase value in hash table
Dave Angel
d at davea.name
Wed Jan 23 17:35:18 EST 2013
On 01/23/2013 10:39 AM, moonhkt wrote:
> On Jan 23, 11:33 pm, moonhk <moon... at gmail.com> wrote:
>> Works.
For some definition of 'works"
>>
>> prndev = line.split()
>> # print line
>> for key in prndev :
>> if key in 'lpr':
This test will fire if key is the letter "l", or the letter "p", or the
letter "r". Probably not what you want. Suggest you change it to
if key == "lpr":
>> val = prndev[5].replace("-P","")
>> if val not in printque:
>> printque[val] = 1
>> else:
>> printque[val] = printque[val] + 1
>> if key in "/dev/null":
ditto here
>> val='null'
>> if val not in printque:
>> printque[val] = 1
>> else:
>> printque[val] = printque[val] + 1
>>
Of course, I don't know what prndev actually looks like, so I could be
wrong as well. But I doubt it "works" as written.
--
DaveA
More information about the Python-list
mailing list