Python- 列表內置方法
阿新 • • 發佈:2017-11-10
rem clear left true end 都是 內置 元素 排序
列表,元組
查
索引(下標) ,都是從0開始
切片
.count 查某個元素的出現次數
.index 根據內容找其對應的位置
"haidilao ge" in a
增加
a.append() 追加
a.insert(index, "內容")
a.extend 擴展
修改
a[index] = "新的值"
a[start:end] = [a,b,c]
刪除
remove("內容")
pop(index)
del a, del a[index]
a.clear() 清空
排序
sort ()
reverse()
身份判斷
>>> type(a) is list
True
>>>
Python- 列表內置方法