Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python List clear()

# list of cars
cars = ['Benz',('volkswagen','BMW'),'Ford','Ferrari',('volkswagen','BMW')]
numbers= [1,(1,3),5,7,(1,3),3,1,6,(1,3)]

# deletes all the elements in the car list
del cars[:]
print("After clearing the car list = ",cars)

# deletes all the elements in the number list
del numbers[:]
print("After clearing the number list = ",numbers)
Source by itsmycode.com #
 
PREVIOUS NEXT
Tagged: #Python #List
ADD COMMENT
Topic
Name
6+6 =