[Python-bugs-list] [ python-Bugs-807107 ] "TypeError: iteration
over non-sequence" for list of strings
SourceForge.net
noreply at sourceforge.net
Tue Sep 16 09:11:17 EDT 2003
Bugs item #807107, was opened at 2003-09-16 13:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=807107&group_id=5470
Category: Parser/Compiler
Group: Python 2.2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Geir M. Koien (gmkoien)
Assigned to: Nobody/Anonymous (nobody)
Summary: "TypeError: iteration over non-sequence" for list of strings
Initial Comment:
The following code gives me the "TypeError: iteration
over non-sequence" error.
I don't see why this shouldn't work.
Python 2.3 (#46, Jul 29 2003, 18:54:32) [MSC v.1200
32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more
information.
list = ["I am a boy", "You are a girl"]
for i in len(list):
line = list[i]
Traceback (most recent call last):
File "<pyshell#39>", line 1, in ?
for i in len(list):
TypeError: iteration over non-sequence
***
If I take the steps manually it works....
>>> len(list)
2
>>> list[0]
'I am a boy'
>>> list[1]
'You are a girl'
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=807107&group_id=5470
More information about the Python-bugs-list
mailing list