Possible Duplicates:
Python - Previous and next values inside a loop
python for loop, how to find next value(object)?
Hi, everyone.
I've got a list contains a lot of elements, I iterate 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 previous element of i, how to achieve that?
I do not have to use a for loop, so feel free to change anything here. Thank you!