Re: Help with parsing a list

2009-12-17 Thread thunderf...@gmail.com
On Dec 17, 6:05 am, Sallu wrote: > Hi i tried with thunderfoot code > > error: > > Traceback (most recent call last): >   File "", line 8, in ? > ValueError: need more than 1 value to unpack- Hide quoted text - > hence, my 'seemingly' functional qualification. :) that's most likely to due to a d

Re: Help with parsing a list

2009-12-17 Thread Sallu
On Dec 17, 4:23 am, "thunderf...@gmail.com" wrote: > not as slick as Emile's (didn't think about using strip() ), but > seemingly functional: > > data = ['key1: data1','key2: data2','key3: data3',' key4: ',' > \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] > result = {} > > for item in data:

Re: Help with parsing a list

2009-12-16 Thread thunderf...@gmail.com
not as slick as Emile's (didn't think about using strip() ), but seemingly functional: data = ['key1: data1','key2: data2','key3: data3',' key4: ',' \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] result = {} for item in data: if item.endswith(': '): currkey = item[:-2] r

Re: Help with parsing a list

2009-12-16 Thread MRAB
J wrote: Hi all, I need some help in turning a list into a dictionary... The list looks something like this: ['key1: data1','key2: data2','key3: data3',' key4: ',' \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] and it's derived from output (via subprocess.Popen) that in a terminal would

Re: Help with parsing a list

2009-12-16 Thread Emile van Sebille
On 12/16/2009 1:32 PM J said... Hi all, I need some help in turning a list into a dictionary... The list looks something like this: ['key1: data1','key2: data2','key3: data3',' key4: ',' \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] and it's derived from output (via subprocess.Popen) th

Help with parsing a list

2009-12-16 Thread J
Hi all, I need some help in turning a list into a dictionary... The list looks something like this: ['key1: data1','key2: data2','key3: data3',' key4: ',' \tdata4.1',' \tdata4.2',' \tdata4.3','key5: data5'] and it's derived from output (via subprocess.Popen) that in a terminal would look like t