Re: [Tutor] Multiple lists from single list with nested lists

2008-10-21 Thread Kent Johnson
On Tue, Oct 21, 2008 at 5:09 PM, Sander Sweers <[EMAIL PROTECTED]> wrote: > This did not work but the below did ;-) > templist = [ somelist[:1] + [x] + somelist[3:] for x in somelist[2] ] somelist[:1] doesn't include somelist[1] so I think you are missing one element of your original list. List

Re: [Tutor] Multiple lists from single list with nested lists

2008-10-21 Thread Sander Sweers
On Tue, Oct 21, 2008 at 01:36, Kent Johnson <[EMAIL PROTECTED]> wrote: >> somelist = ['Test1', 'Text2', ['1', '2'], 'Text3'] >> templist = [] >> for x in range(len(somelist[2])): >>templist.append([somelist[0], somelist[1], somelist[2][x], somelist[3]]) > > Is it always just the third item that

Re: [Tutor] Multiple lists from single list with nested lists

2008-10-20 Thread Kent Johnson
On Mon, Oct 20, 2008 at 5:33 PM, Sander Sweers <[EMAIL PROTECTED]> wrote: > Hi, I am learning myself python and I need to create 2, or more but > let's use 2 as an example, lists from a list with nested lists. > > For example the below, > > ['Test1', 'Text2', ['1', '2'], 'Text3'] > > Should result

[Tutor] Multiple lists from single list with nested lists

2008-10-20 Thread Sander Sweers
Hi, I am learning myself python and I need to create 2, or more but let's use 2 as an example, lists from a list with nested lists. For example the below, ['Test1', 'Text2', ['1', '2'], 'Text3'] Should result in, [['Test1', 'Text2', '1', 'Text3'], ['Test1', 'Text2', '2', 'Text3'] I though of u