Python 列表/數組方法
從 fruits 列表刪除所有元素:
fruits = ['apple', 'banana', 'cherry', 'orange'] fruits.clear()
運行實例
clear() 方法從列表中刪除所有元素。
list.clear()
無參數。