How to construct a list of grouped item based on another list in python?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5764782/iterate-through-pairs-of-items-in-python-list">iterate through pairs of items in python list</a>  </p>
</blockquote>



<p>I have a list and i want to create another one which will encompasses sequent groups of item of the first one based one sliding-window parameter and the size of each group. i.e if the parameter:</p>

<pre><code>a = ["a" ,"b" ,"c" ,"d" ,"e" ,"f"]
</code></pre>

<p>and sliding-window=1 and size =2 
then i want b as:</p>

<pre><code>b= [(a,b),(b,c),(c,d),(d,e),(e,f)]
</code></pre>

<p>the sliding window is for deciding the index of the next tuple.Each time the list would traversed by 1.I.e: If the sliding window was 2 then i would have:
    b= [(a,b),(c,d),(e,f)]</p>

<p>i am looking for a pythonic-way of achieving this.</p>
