I have a simple for loop in Python that is exiting on exceptions even though the exception block contains a continue. There are still about 10 lines left to read when it hits an IndexError and exits the for loop. What am I missing here?
for row in hkx: ##'hkx' are rows being read in from 'csv.open'
try:
print row[2],row[4]
except IndexError, e:
print 'Error:',e
print 'Row Data:',len(row),row
continue ## I thought this would just move on to the next row in 'hkx'
(sorry, total Python newbie here…) Thanks in advance!
wrhk = csv.reader(open(WRHKcsv,'rbU'))hkx = csv.reader(open(HKXcsv,'rb'))wrhk24 = set((row[2],row[4]) for row in wrhk)& there's a code section that uses xlrd to convert an xls file to csv.