Possible Duplicates:
Python - Previous and next values inside a loop
python for loop, how to find next value(object)?
I've got a list that contains a lot of elements, I iterate over the list using a for
loop. For example:
li = [2, 31, 321, 41, 3423, 4, 234, 24, 32, 42, 3, 24, 31, 123]
for i in li:
print(i)
But I want to get the element before i
. How can I achieve that?