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


Groups > comp.lang.python > #19991

Re: iterating over list with one mising value

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <arnodel@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.018
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'transform': 0.07; 'used.': 0.07; 'python': 0.08; 'received:209.85.214.174': 0.13; '1),': 0.16; '3),': 0.16; 'bieber': 0.16; 'guessing': 0.16; 'unpacking': 0.16; 'cc:addr:python-list': 0.16; 'this:': 0.16; 'wrote:': 0.18; 'cc:no real name:2**0': 0.21; 'subject:list': 0.21; 'header:In- Reply-To:1': 0.22; 'feb': 0.22; 'cc:2**0': 0.26; 'load': 0.26; 'work.': 0.27; 'work,': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.29; 'fails.': 0.30; 'does': 0.32; 'tue,': 0.32; 'list': 0.32; 'file': 0.34; 'lee': 0.34; 'something': 0.35; 'received:209.85.214': 0.36; 'list,': 0.36; 'but': 0.37; 'received:google.com': 0.37; 'subject:with': 0.37; 'received:209.85': 0.38; 'correctly': 0.39; 'received:209': 0.39; 'your': 0.61; 'provided': 0.62; 'course,': 0.62; 'dennis': 0.73; 'subject:one': 0.77; 'subject:over': 0.84; 'subject:value': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=cu7rypGgwZGHyhuzd9SNwfsavxq+bpd24oAT8w7SRxI=; b=RDZZIku1ULtk1VVaVBxEMoN+ORbfWyYKMXRNXgUEVUJHB8NENP0XCeMks76WBywuH+ eSbULe2RHOxcl75h49kHCcgK662CmhvKO0TW/SwgGeQeSHQwSuM9reqJYTUufLlJFQ+9 0uthZeSkoGm/iPB4E2HExi7Gd9Cgzu3iSGB+s=
MIME-Version 1.0
In-Reply-To <9na3j751i8q3ks75sda28edig2qclghfht@4ax.com>
References <1328646189.84221.YahooMailClassic@web161206.mail.bf1.yahoo.com> <CAJ6cK1aoMdpdO98oHBvmwVzXq_5bW4yvwU1FuR-tjtXGA72ULg@mail.gmail.com> <9na3j751i8q3ks75sda28edig2qclghfht@4ax.com>
Date Tue, 7 Feb 2012 23:03:51 +0000
Subject Re: iterating over list with one mising value
From Arnaud Delobelle <arnodel@gmail.com>
To Dennis Lee Bieber <wlfraed@ix.netcom.com>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
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.5522.1328655833.27778.python-list@python.org> (permalink)
Lines 25
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1328655833 news.xs4all.nl 6968 [2001:888:2000:d::a6]:46436
X-Complaints-To abuse@xs4all.nl
Xref x330-a1.tempe.blueboxinc.net comp.lang.python:19991

Show key headers only | View raw


On 7 February 2012 22:57, Dennis Lee Bieber <wlfraed@ix.netcom.com> wrote:
> On Tue, 7 Feb 2012 21:37:20 +0000, Arnaud Delobelle <arnodel@gmail.com>
> wrote:
>
>
>>
>>Your list is flat so the unpacking fails.  For it to work, you need
>>your list to be of the form:
>>
>>    wordFreq2 = [('with', 3), ('which', 1), ('were', 2), ('well', 1)]
>>
>>Then it will work.  The quickest way to transform your list to the
>>required form is something like this:
>>
>        Well... From my viewpoint, the quickest way is to load the list
> correctly in the first place... Where does this list come from? If it's
> a file of

Of course, but how much guessing can you do in a reply?  The OP
provided a Python list, that's what I used.

-- 
Arnaud

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


Thread

Re: iterating over list with one mising value Arnaud Delobelle <arnodel@gmail.com> - 2012-02-07 23:03 +0000

csiph-web