[Tutor] List-question

Terry Carroll carroll at tjc.com
Mon Dec 19 20:21:51 CET 2005


On Mon, 19 Dec 2005, Ed Singleton wrote:

> On 19/12/05, Ed Singleton <singletoned at gmail.com> wrote:
> >
> > list2 = list.copy()
> >
> > Slices create a copy, so a shortcut is:
> >
> > list2 = list[:]
> 
> Sorry, you need to:
> 
> from copy import copy
> 
> before you can use copy.

It should also be, after the import:

  list2=copy.copy(list1)

rather than 

  list2=list1.copy()    # or
  list2=list.copy()




More information about the Tutor mailing list