[Tutor] AttributeError: 'list' object has no attribute 'copy'

Kent Johnson kent37 at tds.net
Mon Nov 27 20:55:48 CET 2006

Keith Troell wrote:
> I'm a rank beginner. I am running Python 2.3.5 on the Terminal of Mac  
> OSX.
> The Tutorial (5.1) mentions list.copy as a list method. When I run

Are you sure? I don't see it here:

> scores = [1, 2, 3]
> copy = scores.copy ()
> I get: AttributeError: 'list' object has no attribute 'copy'

You can copy a list with the list() function or by slicing:
copy = list(scores)
copy = scores[:]


More information about the Tutor mailing list