Skip to content

Python code snippet – How to clear an array ?

array = [1, 2, 3, 4, 5, 6, 7, 8, 9]
print(array)
# Output [1, 2, 3, 4, 5, 6, 7, 8, 9]

array.clear()
print(array)
# Output []
See also  Python code snippet - How to distribute a dataset in train and test using scikit?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.