Python Dictionary update() နည်းလမ်း
ဥပမာ
အဘိဓာန်တွင် အကြောင်းအရာတစ်ခုကို ထည့်သွင်းပါ-
car = {
"brand": "Ford",
"model": "Mustang",
"year": 1964
}
car.update({"color": "White"})
print(car)
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
နည်းလမ်း သည် update()
သတ်မှတ်ထားသော အရာများကို အဘိဓာန်တွင် ထည့်သွင်းသည်။
သတ်မှတ်ထားသည့်အရာများသည် အဘိဓာန်တစ်ခု သို့မဟုတ် သော့တန်ဖိုးအတွဲများပါရှိသော ထပ်၍သုံးနိုင်သော အရာတစ်ခု ဖြစ်နိုင်သည်။
အထားအသို
dictionary.update(iterable)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
iterable | A dictionary or an iterable object with key value pairs, that will be inserted to the dictionary |