On Fri, Dec 10, 2010 at 7:18 PM, Dirk Nachbar <dirk...@gmail.com> wrote: > I want to take a copy of a list a > > b=a > > and then do things with b which don't affect a. > > How can I do this? >
b = a[:] will create a copy of the list. If the elements of the list are references to mutable objects (objects of your own classes, for example), you might take a look at copy.deepcopy. -- regards, kushal -- http://mail.python.org/mailman/listinfo/python-list