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: 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> <9na3j751i8q3ks75sda28edig2qclghfht@4ax.com> Date: Tue, 7 Feb 2012 23:03:51 +0000 Subject: Re: iterating over list with one mising value From: Arnaud Delobelle To: Dennis Lee Bieber 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 7 February 2012 22:57, Dennis Lee Bieber wrote: > On Tue, 7 Feb 2012 21:37:20 +0000, Arnaud Delobelle > wrote: > > >> >>Your list is flat so the unpacking fails. =C2=A0For it to work, you need >>your list to be of the form: >> >> =C2=A0 =C2=A0wordFreq2 =3D [('with', 3), ('which', 1), ('were', 2), ('we= ll', 1)] >> >>Then it will work. =C2=A0The quickest way to transform your list to the >>required form is something like this: >> > =C2=A0 =C2=A0 =C2=A0 =C2=A0Well... 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. --=20 Arnaud