title: Identify which iteration you are on in a loop in python
body: <p>Basically I would like to be able to tell when I'm on the Nth item in a loop iteration.
  Any thoughts?</p>
  
  <pre><code>d = {1:2, 3:4, 5:6, 7:8, 9:0}
  
  for x in d:
      if last item: # &lt;-- this line is psuedo code
          print "last item :", x
      else:
          print x
  </code></pre>