Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #37511

Re: Increase value in hash table

Date 2013-01-23 17:35 -0500
From Dave Angel <d@davea.name>
Subject Re: Increase value in hash table
References <32d316a1-8551-4cb2-871f-b0a653c7d2f6@u7g2000yqg.googlegroups.com> <CAHVvXxRhwS4cLxF9d9kOzJVgvHxdtw0rFDzA4j7DF0xkpYnmnQ@mail.gmail.com> <mailman.903.1358955191.2939.python-list@python.org> <3ea1fef0-4a59-49f6-9e4f-ee62009bbb8e@y3g2000pbq.googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.925.1358980542.2939.python-list@python.org> (permalink)

Show all headers | View raw


On 01/23/2013 10:39 AM, moonhkt wrote:
> On Jan 23, 11:33 pm, moonhk <moon...@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Increase value in hash table moonhkt <moonhkt@gmail.com> - 2013-01-22 23:26 -0800
  Re: Increase value in hash table Chris Rebert <clp2@rebertia.com> - 2013-01-22 23:34 -0800
    Re: Increase value in hash table moonhkt <moonhkt@gmail.com> - 2013-01-23 01:23 -0800
  Re: Increase value in hash table Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-23 10:12 +0000
    Re: Increase value in hash table Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 10:47 +0000
      Multiple postings [was Re: Increase value in hash table] Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 21:54 +1100
        Re: Multiple postings [was Re: Increase value in hash table] rusi <rustompmody@gmail.com> - 2013-01-23 06:00 -0800
    Re: Increase value in hash table Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 10:46 +0000
    Re: Increase value in hash table Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 10:46 +0000
    Re: Increase value in hash table Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-23 10:47 +0000
  Re: Increase value in hash table moonhk <moonhkt@gmail.com> - 2013-01-23 23:33 +0800
    Re: Increase value in hash table moonhkt <moonhkt@gmail.com> - 2013-01-23 07:39 -0800
      Re: Increase value in hash table Dave Angel <d@davea.name> - 2013-01-23 17:35 -0500
  Re: Increase value in hash table Vito De Tullio <vito.detullio@gmail.com> - 2013-01-24 19:30 +0100

csiph-web