decouple copy of a list

Dirk Nachbar dirknbr at gmail.com
Fri Dec 10 09:06:42 EST 2010


On Dec 10, 1:56 pm, Wolfgang Rohdewald <wolfg... at rohdewald.de> wrote:
> On Freitag 10 Dezember 2010, Dirk Nachbar 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?
>
> > Dirk
>
> b=a[:]
>
> --
> Wolfgang

I did that but then some things I do with b happen to a as well.



More information about the Python-list mailing list