This code worked fine under 2.6:
f = open("v20100515.csv",'rt')
r = csv.reader(f)
try:
r.next() # skip the header record
for row in r:
n = 1
for col in row:
print str(n) + ": " + col
n += 1
......
But since I upgraded to 3.1, I modified it to say:
f = open("v20100515.csv",'r')
r = csv.reader(f)
try:
r.next() # skip the header record
for row in r:
n = 1
for col in row:
print (str(n) + ": " + col) #new print method in 3.1
n += 1
......
When I try and read a row ( r.next() ), I get:
Message File Name Line Position
Traceback
<module> C:\Users\Dads_Laptop\Documents\Downloads\Toms_PySort.py 90
TypeError: must be bytes or buffer, not str
Also, when I tried to run the code unchanged (except for adjusting the print routines), I was getting Error: 'row' undefined. ????
What changed??