# Python CodeRecipe|pop()の使い方

Home List Methods

# pop()の例1

Remove the second element of the fruit list:

    fruits = ['apple', 'banana', 'cherry']
    fruits.pop(1)

# pop()の定義及び使い方

pop()関数は、 指定された位置。

# pop()の構文

list.pop(pos)

# pop()の引数

パラメータ 説明

pos オプション. A number specifying the position of the element you want to remove, default value is -1, which returns the last item

# Example

Return the removed element:

    fruits = ['apple', 'banana', 'cherry']
    x =
    fruits.pop(1)

Note: The pop() method returns removed value.

Home List Methods