舉例說明:
>>> str=[1,2,3,4,5,2,6]
>>> str.remove(2)
>>> str
[1, 3, 4, 5, 2, 6]
>>> str=[0,1,2,3,4,5,6]
[0, 2, 3, 4, 5, 6]
>>> str2=["abc","bcd","dce"]
>>> str2.pop(2)
"dce"
>>> str2
["abc", "bcd"]
>>> del str[1]
>>> del str2[1]
["abc", "dce"]
[0, 1, 4, 5, 6]
舉例說明:
>>> str=[1,2,3,4,5,2,6]
>>> str.remove(2)
>>> str
[1, 3, 4, 5, 2, 6]
>>> str=[0,1,2,3,4,5,6]
>>> str
[0, 2, 3, 4, 5, 6]
>>> str2=["abc","bcd","dce"]
>>> str2.pop(2)
"dce"
>>> str2
["abc", "bcd"]
舉例說明:
>>> str=[1,2,3,4,5,2,6]
>>> del str[1]
>>> str
[1, 3, 4, 5, 2, 6]
>>> str2=["abc","bcd","dce"]
>>> del str2[1]
>>> str2
["abc", "dce"]
>>> str=[0,1,2,3,4,5,6]
>>> str
[0, 1, 4, 5, 6]