I want to use next() in a for loop to process the following word without advancing the for loop.
words = ["please", "do", "loop", "in", "order"]
for word in words:
print word
checknextword = str(next((word for word in words), None))
Thus, I want to print:
>>>please
>>>do
>>>loop
>>>in
>>>order
But the code produces:
>>>please
>>>loop
>>>order