title: How to get the previous element when using a for loop?
body: <blockquote>
    <p><strong>Possible Duplicates:</strong><br>
    <a href="https://stackoverflow.com/questions/1011938/python-previous-and-next-values-inside-a-loop">Python - Previous and next values inside a loop</a><br>
    <a href="https://stackoverflow.com/questions/3929039/python-for-loop-how-to-find-next-valueobject">python for loop, how to find next value(object)?</a>  </p>
  </blockquote>
  
  
  
  <p>I've got a list that contains a lot of elements, I iterate over the list using a <code>for</code> loop. For example:</p>
  
  <pre><code>li = [2, 31, 321, 41, 3423, 4, 234, 24, 32, 42, 3, 24, 31, 123]
  
  for i in li:
      print(i)
  </code></pre>
  
  <p>But I want to get the element before <code>i</code>. How can I achieve that?</p>