What is the best way to copy a list in Python?
Posted
by sheats
on Stack Overflow
See other posts from Stack Overflow
or by sheats
Published on 2008-10-08T20:11:22Z
Indexed on
2010/03/21
11:11 UTC
Read the original article
Hit count: 270
python
lst1 = ['one', 2, 3]
// What is the best way of the following -- or is there another way?
lst2 = list(lst1)
lst2 = lst1[:]
import copy
lst2 = copy.copy(lst1)
© Stack Overflow or respective owner