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


Groups > comp.lang.python > #37969

Re: help

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.016
X-Spam-Evidence '*H*': 0.97; '*S*': 0.00; 'everyone!': 0.07; 'filename': 0.07; 'subject:help': 0.07; 'python': 0.09; 'iterate': 0.09; 'loop.': 0.09; "'r')": 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iterating': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'jan': 0.18; 'code.': 0.20; '31,': 0.22; 'posted': 0.22; 'example': 0.23; 'errors': 0.23; 'header:In-Reply- To:1': 0.25; 'am,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'lines': 0.28; 'code': 0.31; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'said,': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'useful': 0.36; 'skip:p 20': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'skip:l 20': 0.38; 'some': 0.38; 'things': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'help': 0.40; 'your': 0.60; 'more': 0.63; 'great': 0.64; 'subject': 0.66; "'for'": 0.84; '2013': 0.84; "it'd": 0.84; 'simple!': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=OiHkkvappPGlfdC8XNYfNszt4qkLPbanpnxAbFF5M1U=; b=pYluGtwD3cdEC9UrSvAhblepJcQMGM3nUqQBwVTZLv8Mckc1o6fgBlvAlbKg/Wsup5 w2NiS4Z/upwEJ8qFcnG2hb9FQBU/r7C9TnSBn12/iGwSIQKIaLwBHZp+bebMbR8HZQ/j dk4+NrHpXjOg+FOz+UfRBAAnu1T2/dcADzU8n8Ay89YRSP/fOuCx1cGIxZaJLFFHZTsh sf+BI30spZdTm8FrzZ0UCt/i2CgtsnlGxTnJrBB18eR2Fe6+vvCxmdRQFwtiit3EWXUQ dKBarLMPxzE7Y6Vf3nV54AXJq+kqqIO38ZiyIs4ecVcJndgFZZ4k0/th65HdEhzMa79W GeQA==
MIME-Version 1.0
X-Received by 10.52.29.109 with SMTP id j13mr5472362vdh.111.1359584414631; Wed, 30 Jan 2013 14:20:14 -0800 (PST)
In-Reply-To <cf3b0f42-a133-45df-b1c8-8291b1896878@googlegroups.com>
References <cf3b0f42-a133-45df-b1c8-8291b1896878@googlegroups.com>
Date Thu, 31 Jan 2013 09:20:14 +1100
Subject Re: help
From Chris Angelico <rosuav@gmail.com>
To python-list@python.org
Content-Type text/plain; charset=ISO-8859-1
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.1235.1359584417.2939.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1359584417 news.xs4all.nl 6934 [2001:888:2000:d::a6]:49957
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:37969

Show key headers only | View raw


On Thu, Jan 31, 2013 at 8:16 AM,  <aramildaern@gmail.com> wrote:
> Hi everyone! I don't mean to intrude, but ive heard great things about this group and ive stumped myself with my python code.

Hi! As others have said, this is no intrusion, but it'd help a lot if
you posted your errors and used a more useful subject line.
Additionally, when you post, can you give some example lines from the
file? This part of your code is impossible for us to simulate:

>         fileName = sys.argv[1]
>         jadeFile = open(fileName, 'r')
>
>         for line in jadeFile:
>                 counter = counter + 1
>                 execute(line)
>
>         jadeFile.close()

But this much I can suggest:

>         i = 0
>
>         while i < len(labelList):
>                 print(labelList.keys()[i], ":", labelList.values()[i])
>                 i = i + 1

Instead of iterating with a counter, you can iterate with a Python 'for' loop.

for label,count in labelList.items():
	print(label,":",count)

It's that simple!

ChrisA

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


Thread

help aramildaern@gmail.com - 2013-01-30 13:16 -0800
  Re: help Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-30 15:08 -0700
  Re: help Joel Goldstick <joel.goldstick@gmail.com> - 2013-01-30 17:09 -0500
  Re: help Chris Angelico <rosuav@gmail.com> - 2013-01-31 09:20 +1100
  Re: help Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-31 13:42 +1100
  Re: help Dave Angel <d@davea.name> - 2013-01-30 22:13 -0500

csiph-web