On 3 May 2005 10:42:43 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I'm new to python. I tried doing this > > >>> x = [[]] * 3 > >>> print x > [ [] [] [] ] > >>> x[0].append( 2 ) > [ [2] [2] [2] ] > > I confused with the last line output. I actually expected something > like > > [ [2] [] [] ]
I think you want >>> x[0] = [2] But I have no idea why you're using nested lists in this case ([2] is a one-item-long list, so x is actually a list of lists here). Are you sure this is really what you want? -- Kristian kristian.zoerhoff(AT)gmail.com zoerhoff(AT)freeshell.org -- http://mail.python.org/mailman/listinfo/python-list