Peter Kleiweg wrote: > This does not what I want it to do: > > >>> a = [[]] * 6 > >>> a[3].append('X') > >>> a > [['X'], ['X'], ['X'], ['X'], ['X'], ['X']] > > This does what I want: > > >>> b = [[] for _ in range(6)] > >>> b[3].append('X') > >>> b > [[], [], [], ['X'], [], []] > > The first is clear and wrong. The second is hairy and right. > Is there a way to do it clear and right?
http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list </F> -- http://mail.python.org/mailman/listinfo/python-list