I'm having a problem creating a script that writes a line to a new file while skipping every 5th line. For some reason my code will still write every line, even though the "Skipping" and "Writing" print statements are printed correctly.
i = 0
# loop through array and write to csv
for each in containers:
if i == 5:
i = 0
print("skipping")
else:
f.write(each.a['href'] + "\n")
i = i +1
print("writing")
Any help would be appreciated!
Aucun commentaire:
Enregistrer un commentaire