# Python CodeRecipe|update()の使い方

Home Set Methods

# update()の例1

Insert the items from set y into set
  x:

    x = {"apple", "banana", "cherry"}y = {"google", "microsoft", "apple"}
x.update(y) print(x)

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

update()関数は現在のセットを更新します。 別のセットからアイテムを追加します。 1つの項目が両方のセットに存在する場合は、1つの項目のみが表示されます。 このアイテムの外観は、更新されたセットに表示されます。

# update()の構文

set.update(set)

# update()の引数

パラメータ 説明

set 必須. The set insert into the current set

Home Set Methods