title: How to iterate two files with different steps without loading them all in memory using python?
body: <p>Let's say I have two files A and B</p>
  
  <p>in A I have 100 lines, in B I have 10 lines, I need to do an operation on every 10 lines in A and every 1 line in B.</p>
  
  <p>for example in A, I have following lines
  a1
  a2
  ...
  a10
  a11
  ..
  a20
  ...
  a100</p>
  
  <p>in B I have following lines:
  b1
  b2
  ...
  b10</p>
  
  <p>I would like to do an operation on data a1,a2..a10 and b1, and I would like to do the operation again on data a11, a12... a20 and b2.</p>
  
  <p>So the problem is both A and B are very huge, I cannot load them all in memory, so I need to iterate them line by line, but with different speed because 10 lines in A map to 1 line in B. How to do that without preprocessing A to make it with same row size with B? </p>
  
  <p>(I use python 2.7)</p>