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


Groups > comp.lang.python > #37511

Re: Increase value in hash table

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <d@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.032
X-Spam-Evidence '*H*': 0.94; '*S*': 0.00; 'else:': 0.03; 'val': 0.07; 'works.': 0.07; 'suggest': 0.11; 'line.split()': 0.16; 'written.': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'looks': 0.26; 'am,': 0.27; 'definition': 0.29; 'probably': 0.29; 'could': 0.32; 'print': 0.32; 'doubt': 0.33; 'to:addr:python-list': 0.33; 'wrong': 0.34; 'pm,': 0.35; 'but': 0.36; 'test': 0.36; 'skip:p 20': 0.36; 'well.': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'fire': 0.62; 'here': 0.65; 'received:74.208': 0.71; 'subject:Increase': 0.84; 'subject:value': 0.84
Date Wed, 23 Jan 2013 17:35:18 -0500
From Dave Angel <d@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2
MIME-Version 1.0
To python-list@python.org
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>
In-Reply-To <3ea1fef0-4a59-49f6-9e4f-ee62009bbb8e@y3g2000pbq.googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V02:K0:r71paJaPbXBz8WvGHjQ+sA7o4Nf89cbX5290idupndu WFfoY5PLUCKz8y5vXLBlC19pebFx4rHoZh1P+EUIRqP20gX/rE IkThtJ+WtiXHDb0GWYKXNOMJZdr3pvib85iuxYVVBO8qjiL/wc Noo8QQqh2WGUSFjF0GU1y29ETrEsf243wyTQGFzjB9Q5sWr+Mf jS26St2zGlUNEaEIeX5Sqs8aEOLMFwZHD62SMCy3JVyjRGlXex dT29AMl0VxVfYMgtdj8EEeLlotiuZV9pxqLxMCqSdfK8N/fGIU 6kLy5UdyiO+6PTswXkSOYZ1VmDsfnj9UOCnrwK6Du1Kv3sZqg= =
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.925.1358980542.2939.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1358980542 news.xs4all.nl 6954 [2001:888:2000:d::a6]:47970
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37511

Show key headers only | 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