Python Clearing a List
Define a list and clear it; this can be done with the clear() method.
Example 1
RUNOOB
=
[
6
,
0
,
4
,
1
]
(
'Before clearing:'
,
RUNOOB
)
RUNOOB.
clear
(
)
(
'After clearing:'
,
RUNOOB
)
The output of the above example is:
清空前: [6, 0, 4, 1]
清空后: []
Python3 Examples