fork download
  1. def wind(array, cols):
  2. return [[array[i+ (row*cols)] for i in xrange(cols)] for row in xrange(len(array)/cols)]
  3.  
  4. print wind(range(9), 3)
Success #stdin #stdout 0.02s 4676KB
stdin
Standard input is empty
stdout
[[0, 1, 2], [3, 4, 5], [6, 7, 8]]