backwards loop over list in python

41

>>> a = ["foo", "bar", "baz"]
>>> for i in reversed(a):
...     print(i)
... 
baz
bar
foo

Comments

Submit
0 Comments