mardi 15 décembre 2015

Best way to check next iteration value

I want to write a line of code that checks if the iteration i==someValue and the next iteration i==anotherValue then write a line of code in the loop.

E.g

for line in file:
    if line[1]=='A' and if next(line[1]) == 'B'
    print("do something here")

How can I go about achieving this?

Thanks!

Aucun commentaire:

Enregistrer un commentaire