Path: csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'ok.': 0.07; "subject:' ": 0.07; 'python': 0.09; '"': 0.09; 'imports': 0.09; 'subject:iterable': 0.09; 'tuple': 0.09; 'typeerror:': 0.09; 'cc:addr:python-list': 0.10; 'subject:not': 0.11; 'subject:object': 0.16; 'why:': 0.16; 'wrote:': 0.17; 'thu,': 0.17; 'why.': 0.17; 'code,': 0.18; 'email addr:gmail.com>': 0.20; 'trying': 0.21; 'cc:2**0': 0.23; 'this:': 0.23; 'pass': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'appear': 0.26; 'wrote': 0.26; 'am,': 0.27; 'list:': 0.27; 'message-id:@mail.gmail.com': 0.27; 'piece': 0.29; 'url:mailman': 0.29; 'saves': 0.30; 'error': 0.30; 'url:python': 0.32; 'print': 0.32; 'url:listinfo': 0.32; 'excel': 0.33; 'likely': 0.33; 'me?': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'list': 0.35; 'sequence': 0.35; 'but': 0.36; 'url:org': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'help': 0.40; 'url:mail': 0.40; 'range': 0.60; 'most': 0.61; 'here': 0.65; '2013': 0.84; 'ana': 0.91; 'joel': 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:cc:content-type; bh=qdaqg9boZfPPFoFgSE64lA1rTFvXQhx3hs8GladzMmI=; b=jbJMQqPUpkDLvgn3ItJW90Ucf8WkfToDWmuQYT7fqVQIy/5xLsAbaQhw6j4NT06WG5 1yVPvqamVWnmpM+Ijm+8871A6xTKm4UlR4Ucbh12wpqQjKfghXvKUxRuaR2Z4pKfjZ/q yVqFA12s3yVepsfnjmXw2sYDtL9nSwWsxr8G77UNinWt3A9hluPqlUV/XPvlqBluGyBX D1dVM4IuXLdKlSPMjToO0870Q0Xr1odwJag377c0k4Y3ZwIMwZCqAnogxM8feg02H7cR SiGxe95P7PQU7cb+M6+TzxrLzwoTqAWEyv630IvSGvECAzZmu8UyYdmnSpmZLGEr5o9c +TMA== MIME-Version: 1.0 X-Received: by 10.52.155.5 with SMTP id vs5mr730575vdb.24.1363257062473; Thu, 14 Mar 2013 03:31:02 -0700 (PDT) In-Reply-To: <3984882c-0144-47ba-af4f-b29877bc4698@googlegroups.com> References: <3984882c-0144-47ba-af4f-b29877bc4698@googlegroups.com> Date: Thu, 14 Mar 2013 06:31:02 -0400 Subject: Re: TypeError: 'float' object is not iterable From: Joel Goldstick To: =?UTF-8?Q?Ana_Dion=C3=ADsio?= Content-Type: multipart/alternative; boundary=089e01633a94f27c0e04d7e004d2 Cc: "python-list@python.org" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 111 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1363257065 news.xs4all.nl 6856 [2001:888:2000:d::a6]:39974 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:41220 --089e01633a94f27c0e04d7e004d2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, Mar 14, 2013 at 6:12 AM, Ana Dion=C3=ADsio wrote: > Hi!! > > I keep having this error and I don't know why: TypeError: 'float' object > is not iterable. > > I have this piece of code, that imports to python some data from Excel an= d > saves it in a list: > > " > t_amb =3D [] > > for i in range(sh2.nrows): > t_amb.append(sh2.cell(i,2).value) > > print t_amb > > " > Here is everything ok. > > But then, I need to pass the data again to exel, so I wrote this: > > " > a=3D8 > for b in range (len(t_amb)): > a=3D8 > for d in t_amb[b]: > a=3Da+1 > sheet.write(a,b+1,d) > " > > The error appear in "for d in t_amb[b]:" and I don't understand why. Can > you help me? > Most likely the value of t_amb[[b] is a float. It would have to be a list or a tuple or some other sequence to be iterable. I can't tell what you are trying to do here > -- > http://mail.python.org/mailman/listinfo/python-list > --=20 Joel Goldstick http://joelgoldstick.com --089e01633a94f27c0e04d7e004d2 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable



On Thu, Mar 14, 2013 at 6:12 AM, Ana Dion=C3=ADsio <anadion= isio257@gmail.com> wrote:
Hi!!

I keep having this error and I don't know why: TypeError: 'float= 9; object is not iterable.

I have this piece of code, that imports to python some data from Excel and = saves it in a list:

"
t_amb =3D []

for i in range(sh2.nrows):
=C2=A0 =C2=A0 t_amb.append(sh2.cell(i,2).value)

print t_amb

"
Here is everything ok.

But then, I need to pass the data again to exel, so I wrote this:

"
a=3D8
for b in range (len(t_amb)):
=C2=A0 =C2=A0 a=3D8
=C2=A0 =C2=A0 for d in t_amb[b]:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 a=3Da+1
=C2=A0 =C2=A0 =C2=A0 =C2=A0 sheet.write(a,b+1,d)
"

The error appear in "for d in t_amb[b]:" and I don't understa= nd why. Can you help me?

Most likely th= e value of t_amb[[b] is a float.=C2=A0 It would have to be a list or a tupl= e or some other sequence to be iterable.=C2=A0 I can't tell what you ar= e trying to do here
--
http://mail.python.org/mailman/listinfo/python-list



--
--089e01633a94f27c0e04d7e004d2--