Python Dictionary get() Method

0
9Кб

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
Поиск
Категории
Больше
Искусство, культура и развлечения
Мое сердце разрывается. My Heart Goes Boom!. (2020)
Мюзикл, основанный на хитах популярной итальянской певицы Рафаэллы Карра. Мария с детства мечтала...
От Nikolai Pokryshkin 2022-09-27 17:23:39 0 25Кб
Социальные проблемы
Бешеные псы. Reservoir Dogs. (1992)
Это должно было стать идеальным преступлением. Задумав ограбить ювелирный магазин, криминальный...
От Nikolai Pokryshkin 2023-01-11 17:57:32 0 24Кб
Business
Can Intrapreneurship Lead to Entrepreneurship?
The lines between intrapreneurship and entrepreneurship are often blurred, and for good reason....
От Dacey Rankins 2025-04-17 12:53:56 0 7Кб
Научная фантастика и фэнтези
Интерстеллар. Interstellar. (2014)
Когда засуха, пыльные бури и вымирание растений приводят человечество к продовольственному...
От Nikolai Pokryshkin 2022-11-19 17:29:10 0 29Кб
Arts, Culture and Entertainment
The Prom (2020)
In desperate need of a noble cause to revive their public images and bounce back, self-centred...
От Leonard Pokrovski 2022-09-26 20:48:09 0 22Кб
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov