I'm reading the file, so how do I get the turns, or index for each line?
for line in excelRead:
keywrds=[]
title=line.split("+")
title=[lines.strip()for lines in title]
print title[0]
So, when I read my first line in excel, line variable is equal to line value in excel, but how do I find which turn it is?
Use enumerate()
:
for index, line in enumerate(excelRead, start=1):
keywrds=[]
title=line.split("+")
title=[lines.strip()for lines in title]
print title[0]
print index
The start
parameter to the enumerate
indicates that you want to start the index at 1, instead of 0.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments