0 points

How to remove all elements from the list


dashboard

Tue Apr 21 2020 06:34:03 GMT+0000 (UTC)

Posted by @Melody #python #python #lists #clear #remove

# a characters list
          1.characters = ['a', 'b', 'c', 'd', 'e', 'f']
          2.characters.clear()
                                
                                
content_copy Copy

"clear" is the keyword that is used in a list to remove all the elements from the list. When you run this code there will be no output.

https://learnandlearn.com/python-programming/python-reference/python-remove-list-all-items-clear-function-with-examples