Raj Medhekar wrote:
> Thanks that works! But what if I wanted to modify 2 of the three lists
> in 2 different positions? Could you please let me know how I would go
> about doing that?
M[0].insert(2, 'foo')
M[2].insert(1, 'bar')
___
Tutor maillist - T
PM
Subject: Re: [Tutor] Using insert method on a list matrix
try
M[0].insert(0, 'pod')
-Original Message-
>
>From: Raj Medhekar
>
>Sent: Jul 19, 2009 7:12 PM
>
>To: Python Tutor
>
>Subject: [Tutor] Using insert method on a list matrix
>
>
&
"Raj Medhekar" wrote
I would like to know how I could use the insert method in a
List matrix
OK, A list "matrix" is just a list containing other lists.
TThere is nothing special about it, it is just an ordinary list.
You could do it in two steps:
firstList = M[0]
firstList.insert(0,'pod')
try M[0].insert(0, 'pod')-Original Message-
From: Raj Medhekar
Sent: Jul 19, 2009 7:12 PM
To: Python Tutor
Subject: [Tutor] Using insert method on a list matrix
I would like to know how I could use the insert method in a List matrix eg. for the matrix belowM=[[1,2,3], [3,2,
I would like to know how I could use the insert method in a List matrix eg. for
the matrix below
M=[[1,2,3], [3,2,1], [4,3,2]]
if wanted to insert the string 'pod' in list [0] before [1] in list [0] in M
using the built in method insert How would I go about doing this? I've tried
may List Comp