absolute newbie: divide a list into sublists (nested lists?) of fixed length

2009-04-11 Thread ergconcepts
Hi, I have a list looking like [ 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675, 0.84971586, 0.05786009, 0.9645675] and I would like to break this list into subsets of fixed length (say, three elements), i.e. to convert the list int

Re: absolute newbie: divide a list into sublists (nested lists?) of fixed length

2009-04-11 Thread ergconcepts
On Apr 11, 10:37 pm, Andreas Pfrengle wrote: > my_list = [] > for x in range(3): >  my_list.append([]) >  for y in range(3): >   my_list[x].append(some_value) Thanks for your help - but I'm sorry I do not understand: > my_list = [] I guess here you are implying to write something like my_list

Re: absolute newbie: divide a list into sublists (nested lists?) of fixed length

2009-04-11 Thread ergconcepts
On Apr 11, 11:18 pm, George Sakkis wrote: > The numpy import *is* important if you want to use numpy-specific > features; there are many "tricks" you can do easily with numpy arrays > that you have to write manually for, say, regular python lists. For > example what you want to do is trivial with