motorcycles = ['honda', 'yamaha', 'suzuki'] print(motorcycles) #可通过索引修改相应的元素 motorcycles[0] = 'ducati1' print(motorcycles) #append可在集合后面追加元素 motorcycles.append('ducati2') print(motorcycles) #insert可在指定索引位置添加元素 motorcycles.insert(1, 'ducati3') print(motorcycles) #del可删除指定索引位置的元素 del motorcycles[1] print(motorcycles) #pop可在删除列表元素的同时继续使用该元素,可使用索引选择元素,默认是-1索引 popped_motorcycles = motorcycles.pop(0) print(motorcycles) print(popped_motorcycles) #remove可根据指定的元素值来删除元素,如果列表中有多个相同的元素,remove只删除第一个 motorcycles.remove('ducati2') print(motorcycles)