substitution of list elements

2008-07-18 Thread antar2
I want to replace each first element in list 5 that is equal to the first element of the list of lists4 by the fourth element. I wrote following code that does not work: list4 = [['1', 'a', 'b', 'c'], ['2', 'd', 't', 'e'], ['8', 'g', 'q', 'f']] list5 = ['1', '2', '3'] for j in list4: for k in

Re: substitution of list elements

2008-07-18 Thread Wolfram Kraus
Am 18.07.2008 14:33, antar2 schrieb: I want to replace each first element in list 5 that is equal to the first element of the list of lists4 by the fourth element. I wrote following code that does not work: list4 = [['1', 'a', 'b', 'c'], ['2', 'd', 't', 'e'], ['8', 'g', 'q', 'f']] list5 = ['1',

Re: substitution of list elements

2008-07-18 Thread [EMAIL PROTECTED]
On 18 juil, 14:33, antar2 [EMAIL PROTECTED] wrote: I want to replace each first element in list 5 that is equal to the first element of the list of lists4 by the fourth element. I wrote following code that does not work: list4 = [['1', 'a', 'b', 'c'], ['2', 'd', 't', 'e'], ['8', 'g', 'q',