how to clear up a List in python?

vbgunz vbgunz at gmail.com
Thu May 25 11:50:14 EDT 2006


> del list1[:]

thank you for that reply. I never thought of [:] cause to be me I
thought it would immediately make a copy of the list or if anything
that it would delete a copy so I never played with it. nice :)

>  del list1[:-1000]   # keep max. last 1000 appended items in the list
>  list1[:]=replace_list

very much thanks for the tips. they're great!




More information about the Python-list mailing list