I have a decoded file from an html form stored in a variable:
file_data = file.read().decode('utf-8')
print(file_data)
I want to iterate through the file with a counter that keeps track of the row number so that I can get the row number of when the table begins. These are the two ways I've tried to do it:
Method 1:
counter = 0
for row in file_data:
if row == 'Date,Unique Id,Tran Type,Cheque Number,Payee,Memo,Amount':
date_line_no = counter
break
counter += 1
Method 2:
for line, row in enumerate(file_data):
first_column = row[0]
if first_column == 'Date':
print(row)
date_line_no = line
My ideal output would be 7, as that is when the table begins with its columns.
