Need help initializing a list or tuple.

Fredrik Lundh fredrik at pythonware.com
Mon Mar 6 12:10:56 EST 2006


"KraftDiner" wrote:

> I need a matrix of 256 x 256 unsigned short values...
> The matrix can be implemented as a list of lists or a tuple...
> So for example:
> [[1][2][3], [4][5][6], [7][8][9]]
> or
> ((1,2,3),(4,5,6), (7,8,9))
>
> This is what I have so far but its not working...
>
> a = [][]
> for i in range(0,256):
> for j in range(0,256):
> a[i][j] = i**2

this might help:

http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list

</F>






More information about the Python-list mailing list