Pythonic loops--how to get multiple elements while iterating a list
<p>I want to iterate over my list and do something with multiple elements, not just one element. I want to take the first element and some elements after it (they could be sequential or maybe the 3rd element from the one returned).</p>

<pre><code>l = ['a', 'b', 'c', 'd', 'e']
  for items in l:
    print items[:3]
</code></pre>

<p>The output should be:</p>

<pre><code>['a', 'b', 'c'], ['b', 'c', 'd'], ['c', 'd', 'e']
</code></pre>

<p>There are a lot of good answers, what if want to skip elements? 
Say, get an element, skip the next element, and get the 3rd element?</p>

<p>Output:</p>

<pre><code>('a', 'c'), ('b','d'), ('c', 'e')
</code></pre>

<p>I guess enumerate is the best way to handle this?</p>

<p>Iterating through lists so simple and elegant I hoped similar syntax would allow you to use it inside a for loop on the element itself and not use range or enumerate.</p>

<pre><code>l = ['a', 'b', 'c', 'd', 'e']
  for items in l:
    print (items[0], items[2])
</code></pre>

<p>(Yes, I know this code would give different results if the original list was a list containing lists. [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ] would return [1, 3], [4, 6], [7, 9])</p>
