First post from a Python newbiw

Terry Reedy tjreedy at udel.edu
Sun Mar 2 17:02:25 EST 2008


"Christoph Zwerschke" <cito at online.de> wrote in message 
news:fqf4do$gq7$1 at online.de...
| Marc 'BlackJack' Rintsch schrieb:
| > On Sun, 02 Mar 2008 14:15:09 +0000, Steve Turner wrote:
| >
| >> Apart from doing something like
| >> a=[0,0,0]
| >> b=[0,0,0]
| >> c=[0,0,0]
| >> d=[a,b,c]
| >>
| >> is there a better way of creating d??
| >
| > a = [[0] * 3 for dummy in xrange(3)]
|
| Why not simply [[0]*3]*3 ?

Because that is essentially the same as what the OP originally did,
which does not work as he wanted.






More information about the Python-list mailing list