Pythonリストremove()メソッド
例
fruit
リストの「バナナ」要素を削除します。
fruits = ['apple', 'banana', 'cherry']
fruits.remove("banana")
定義と使用法
このremove()
メソッドは、指定された値を持つ要素の最初の出現を削除します。
構文
list.remove(elmnt)
パラメータ値
Parameter | Description |
---|---|
elmnt | Required. Any type (string, number, list etc.) The element you want to remove |