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


Groups > comp.lang.python > #41223

Re: TypeError: 'float' object is not iterable

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'ok.': 0.07; "subject:' ": 0.07; 'python': 0.09; 'imports': 0.09; 'iterate': 0.09; 'subject:iterable': 0.09; 'typeerror:': 0.09; 'subject:not': 0.11; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.93': 0.16; 'received:84.93.230': 0.16; 'subject:object': 0.16; 'why:': 0.16; 'wrote:': 0.17; 'why.': 0.17; 'code,': 0.18; 'this:': 0.23; 'pass': 0.25; 'header:In- Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'appear': 0.26; 'wrote': 0.26; 'list:': 0.27; 'piece': 0.29; 'saves': 0.30; 'error': 0.30; 'received:84': 0.32; 'print': 0.32; 'to:addr :python-list': 0.33; 'excel': 0.33; 'me?': 0.33; "can't": 0.34; 'list': 0.35; 'but': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'received:192.168': 0.40; 'help': 0.40; 'range': 0.60; 'here': 0.65; 'header:Reply-To:1': 0.68; 'reply- to:no real name:2**0': 0.72; 'float,': 0.84; 'reply- to:addr:python.org': 0.84; 'ana': 0.91
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=HO4d4PRv c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=B68SgI_Jlq8A:10 a=_yxKM6GybEgA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=9K3glyaPVLkA:10 a=e049oSjzyXoL1lSOmXwA:9 a=wPNLvfGTeEIA:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Thu, 14 Mar 2013 10:43:48 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130307 Thunderbird/17.0.4
MIME-Version 1.0
To python-list@python.org
Subject Re: TypeError: 'float' object is not iterable
References <3984882c-0144-47ba-af4f-b29877bc4698@googlegroups.com>
In-Reply-To <3984882c-0144-47ba-af4f-b29877bc4698@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 8bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
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.3294.1363257819.2939.python-list@python.org> (permalink)
Lines 33
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1363257819 news.xs4all.nl 6922 [2001:888:2000:d::a6]:48458
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:41223

Show key headers only | View raw


On 14/03/2013 10:12, Ana Dionísio 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?
>
t_amb is a list of float, so t_amb[b] is a float, but you can't iterate
over a float.

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