पायथन डिक्शनरी अपडेट () विधि
उदाहरण
शब्दकोश में एक आइटम डालें:
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 |