#1
|
|||
|
|||
deleting elements inside a list problem
how can I remove all the elements inside a list?
|
#2
|
|||
|
|||
If it's a simple python related question (and not specifically Vizard) you should try googling your questions first, 90% of the time you'll fine the answer
I Googled "Lists - Python" turned up: http://www.faqs.org/docs/diveintopyt...lper_list.html Scroll down the page and you'll fine your answer. Last edited by DrunkenBrit; 02-12-2009 at 11:50 PM. |
#3
|
|||
|
|||
thanks, but i need to know how to remove all the elements with one code. For example I have a list:
list = [a,b,c,f,d,h,y] and i want to write a code to delete from first element to last. I can't find any code. |
#4
|
|||
|
|||
I google searched again and came across this: http://effbot.org/zone/python-list.htm
It covers what you need to know If you're working with lists I suggest you read it. To delete all elements in a list you use a slice like so: Code:
list = [a,b,c,f,d,h,y] del list[:] # Deletes all elements print list # Check all items have been removed |
|
|