How to remove all items from a list in Python

2 Answers

0 votes
lst = [4, 7, 0, 9, 1, 3, 5,]

lst.clear()

print(lst)



'''
run:

[]

'''

 



answered Feb 28, 2023 by avibootz
0 votes
lst = [4, 7, 0, 9, 1, 3, 5,]

del lst[:]

print(lst)



'''
run:

[]

'''

 



answered Feb 28, 2023 by avibootz

Related questions

...