Answers for "how to clear elements of a list in python"

7

how to clear a list in python

yourlist = [1,2,3,4,5,6,7,8]
del yourlist[:]
Posted by: Guest on April-08-2020
1

how to clear the list in python

thislist = ["apple", "banana", "cherry"]
thislist.clear()
print(thislist)
Posted by: Guest on December-24-2021
1

how to delete whole list in python

thislist = ["apple", "banana", "cherry"]
print(thislist)
del thislist
print(thislist)
Posted by: Guest on December-24-2021

Code answers related to "how to clear elements of a list in python"

Python Answers by Framework

Browse Popular Code Answers by Language