Python Dictionary get() Method

0
6K

With the built-in get() method, you can get the value from retrieving the specific key. If you put in a key that doesn't exist in the dictionary, it'll raise a KeyError. Here's an example:

car = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
x = car.get("model")
print(x)
 
>> Mustang
Cerca
Categorie
Leggi tutto
Научная фантастика и фэнтези
ВАЛЛ-И. WALL·E (2008)
Робот ВАЛЛ·И из года в год прилежно трудится на опустевшей Земле, очищая нашу планету от...
By Nikolai Pokryshkin 2022-12-14 10:18:15 0 24K
Business
How to Effectively Measure Customer Satisfaction: A Guide to CSAT
Customer satisfaction is one of the key metrics of customer service, and it's an axiom. It allows...
By Dacey Rankins 2024-09-19 16:59:32 0 11K
Телевидение
Телеканал Саратов 24 прямая трансляция.
"Саратов 24" — начал вещание 14 ноября 2014 года. Это уникальный формат телевидения,...
By Nikolai Pokryshkin 2022-11-07 11:09:07 0 16K
Business
Product marketing: what is it and why is it needed in IT  
Product marketing: what is it and why is it needed in IT   Launching a new product on...
By Leonard Pokrovski 2024-08-28 21:41:43 0 12K
Телевидение
Телеканал Любимое. TV онлайн.
Телеканал для всей семьи Любимое.TV - только доброта, любовь и радость. Моя ссылка
By Nikolai Pokryshkin 2022-10-12 19:37:52 0 24K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov