how to clear up a List in python?

robert no-spam at no-spam-no-spam.com
Thu May 25 11:02:14 EDT 2006


python wrote:

> I have new a list , when it hava large number of values, I wonna to
> delete all the values in it,how to do?
> And, if a list have 801 values, I want to get its values index from 300
> to 400, could use list1[300:400],are right me?
> 


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

-robert



More information about the Python-list mailing list