clear()方法是用于清空列表的,基本语法:
list.clear()
代码示例:
List = [6, 0, 4, 1]print('List清空前:', List)#清空元素List.clear()print('List清空后:', List)