mentby.com
Blog | Jobs | Help | Signup | Login

loading
Please remember to tell us what error, with the traceback, so that we can  
make fun of you for not reading it :-)  In this case it's pretty obvious;  
Python will complain that you can't call len() on an integer (because it's  
not a container type, so the whole idea of "length" is meaningless).  You  
probably meant to use "range(10)" instead of "len(10)", but then "row"  
would be the integers from 0 to 9 inclusive, which isn't what you want  
either.

What you actually want to do is "row = p.next()" (in Python 2.x) or "row =  
next(p)" (in Python 3.x) to get the next row from the CSV file, add it to  
the array and repeat until you have ten more lines.  Another for-loop will  
make this less tedious to write.

Odd that this subject should have come up so many times in various guises  
in the last week or two.

--
Rhodri James *-* Wildebeest Herder to the Masses
--  http://mail.python.org/mailman/listinfo/python-list

Understanding Boolean Expressions

Tue, 16 Apr 2013 16:33:10 -0700 Post Comments

What the grammar rules are giving you is operator precedence -- "not" has  
higher precedence than "and", which is higher than "or".  As you follow  
the non-terminals back you go further through precedence chain:  
comparisons, then bitwise operators (*not* bitwise comparisons!), then  
shifts, then arithmetic operators, the unary operators, the power  
operator, and finally primaries.

--
Rhodri James *-* Wildebeest Herder to the Masses

PyWart (Terminolgy): "Class"

Mon, 14 Jan 2013 14:59:11 -0800 Post Comments

Now read the rest of the thread.  While it is true that Rick offers  
sufficiently many daft opinions that ridicule is actually likely to be the  
correct response, there have been detailed (and therefore ignored)  
responses pointing out his failure to understand both the English language  
and the last couple of decades of computer science.

--
Rhodri James *-* Wildebeest Herder to the Masses
Group(s)
Profile Widget
Copy and paste this HTML code to your blog or website: