Creating a list of lists with consecutive numbers

Posted by Henrik on Stack Overflow See other posts from Stack Overflow or by Henrik
Published on 2010-03-09T10:59:02Z Indexed on 2010/03/09 11:06 UTC
Read the original article Hit count: 304

Filed under:
|

I am looking for a convenient way to create a list of lists for which the lists within the list have consecutive numbers. So far I only came up with a very unsatisfying brute-typing force solution (yeah right, I just use python for a few weeks now):

block0 = []
...
block4 = []

blocks = [block0,block1,block2,block4]

I appreciate any help that works with something like nrBlocks = 4.

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner