fork download
  1. from itertools import islice
  2.  
  3. linCirc = [[1,10],
  4. [2, 1],
  5. [0, 2],
  6. [2, 2],
  7. [2, 3],
  8. [2, 4],
  9. [2, 0],
  10. [2, 5]]
  11.  
  12. it = iter(linCirc)
  13. for element, n in it:
  14. if not element: # skip n elements
  15. next(islice(it, n, n), None) # see consume() recipe from itertools docs
  16. print(element, n)
Success #stdin #stdout 0.02s 5852KB
stdin
Standard input is empty
stdout
1 10
2 1
0 2
2 4
2 0
2 5