Python Clear List
Define a list and clear it, which can be done using the clear() method.
Example 1
EXAMPLE = [6, 0, 4, 1]
print('Before clearing:', EXAMPLE)
EXAMPLE.clear()
print('After clearing:', EXAMPLE)
print('Before clearing:', EXAMPLE)
EXAMPLE.clear()
print('After clearing:', EXAMPLE)
The output of the above example is:
清空前: [6, 0, 4, 1] 清空后: []Other Extensions
Python3 Examples