Python bug? Indexing to matrices
Chris Rebert
clp2 at rebertia.com
Tue Jul 12 01:44:05 EDT 2011
On Mon, Jul 11, 2011 at 10:39 PM, David <davidbtdt at gmail.com> wrote:
> Should the following line work for defining a matrix with zeros?
>
> c= [[0]*col]*row
>
> where "col" is the number of columns in the matrix and "row" is of
> course the number of rows.
Nope. See the FAQ:
http://docs.python.org/faq/programming.html#how-do-i-create-a-multidimensional-list
Cheers,
Chris
More information about the Python-list
mailing list