Python Set update() နည်းလမ်း
ဥပမာ
set မှ ပစ္စည်းများကို set y
ထဲသို့ထည့်
x
ပါ
x = {"apple", "banana", "cherry"}
y = {"google", "microsoft", "apple"}
x.update(y)
print(x)
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
နည်းလမ်း သည် update()
အခြားအစုံမှ အရာများ (သို့မဟုတ် အခြားထပ်၍ရနိုင်သော အရာများ) ကို ပေါင်းထည့်ခြင်းဖြင့် လက်ရှိ set ကို update လုပ်ပါသည်။
ပစ္စည်းတစ်ခုသည် နှစ်စုံစလုံးတွင် ရှိနေပါက၊ အပ်ဒိတ်လုပ်ထားသောအစုံတွင် ဤအရာ၏အသွင်အပြင်တစ်ခုသာ ရှိနေမည်ဖြစ်သည်။
အထားအသို
set.update(set)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
set | Required. The iterable insert into the current set |