Copy List

Lawrence Oluyede raims at dot.com
Wed Jul 18 09:48:02 EDT 2007


Joe Riopel <goon12 at gmail.com> wrote:
> I am pretty new to python but this works:
> 
> >>> list_one = [0,1,2,3,4,5,6,7,8,9]
> >>> list_two = [i for i in list_one]
> >>> print list_two
> [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

>> list_two = list_one[:]

or 

>> list_two = list(list_one)

are better :D

-- 
Lawrence, oluyede.org - neropercaso.it
"It is difficult to get a man to understand 
something when his salary depends on not
understanding it" - Upton Sinclair



More information about the Python-list mailing list