freiwndz 7b17bfd26b .
meublés 3b17bfd26b .
...
If you have any idea why this happens, I would be really grateful if you could explain it to me.
A:
In your loop, you set up the reading of the first row of csv file.
When you read the 2nd row of the file, the file pointer will be at the beginning of the 3rd row.
If you want to continue to read rows from the end of the file, just add another loop,
filepointer.seek(0)
while True:
row = filepointer.readline()
if row == "" or row[0]!= "Y" or row[1]!= "T" or row[2]!= "U" or row[3]!= "T" or row[4]!= "C" or row[5]!= "T" or row[6]!= "S":
break
For the condition row!= "" at the end of your loop, you might want to add a count in order to control how many times the loop will run. It is not a good idea to keep re-opening the file.
while True:
filepointer.seek(0)
count = 0
while True:
row = filepointer.readline()
if row!= "" or row[0]!= "Y" or row[1]!= "T" or row[2]!= "U" or row[3]!= "T" or row[4]!= "C" or row[5]!= "T" or row[6]!= "S":
break
else:
count = count + 1
if count == 5:
break
FILE PHOTO: The logo of Uber Technologies is seen on the driver-side mirror of a car in San Francisco, California, U.S. February 14, 2018. REUTERS/Josh Ed be359ba680
Related links:
Comentarios