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


Groups > comp.lang.python > #41220

Re: TypeError: 'float' object is not iterable

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 <joel.goldstick@gmail.com>
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; '&quot;': 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&gt;': 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 <joel.goldstick@gmail.com>
To Ana Dionísio <anadionisio257@gmail.com>
Content-Type multipart/alternative; boundary=089e01633a94f27c0e04d7e004d2
Cc "python-list@python.org" <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 <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.3291.1363257065.2939.python-list@python.org> (permalink)
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

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Thu, Mar 14, 2013 at 6:12 AM, Ana Dionísio <anadionisio257@gmail.com>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 and
> saves it in a list:
>
> "
> t_amb = []
>
> 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=8
> for b in range (len(t_amb)):
>     a=8
>     for d in t_amb[b]:
>         a=a+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
>



-- 
Joel Goldstick
http://joelgoldstick.com

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


Thread

TypeError: 'float' object is not iterable Ana Dionísio <anadionisio257@gmail.com> - 2013-03-14 03:12 -0700
  Re: TypeError: 'float' object is not iterable Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-14 06:31 -0400
    Re: TypeError: 'float' object is not iterable Ana Dionísio <anadionisio257@gmail.com> - 2013-03-14 03:34 -0700
      Re: TypeError: 'float' object is not iterable Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-14 06:44 -0400
      Re: TypeError: 'float' object is not iterable Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-03-14 18:09 -0400
    Re: TypeError: 'float' object is not iterable Ana Dionísio <anadionisio257@gmail.com> - 2013-03-14 03:34 -0700
  Re: TypeError: 'float' object is not iterable MRAB <python@mrabarnett.plus.com> - 2013-03-14 10:43 +0000
  Re: TypeError: 'float' object is not iterable Chris Rebert <clp2@rebertia.com> - 2013-03-14 03:50 -0700
  Re: TypeError: 'float' object is not iterable John Ladasky <john_ladasky@sbcglobal.net> - 2013-03-14 11:11 -0700

csiph-web