Python Dictionary get() Method
Posté 2023-03-07 22:06:39
0
7KB
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
Rechercher
Catégories
- Arts
- Business
- Computers
- Jeux
- Health
- Domicile
- Kids and Teens
- Argent
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Lire la suite
Kill Bill: Vol. 1. (2003)
After awakening from a four-year coma, a former assassin wreaks vengeance on the team of...
ABS, Live TV. Antigua & Barbuda.
The face of local broadcasting in Antigua and Barbuda. ABS TV is an Internet only TV channel...
Is Lean Startup Applicable Only to Tech Companies?
The Lean Startup methodology, popularized by Eric Ries, is often associated with technology...
Arts and Culture
Culture and art is a rather specific direction, if we describe it in terms of employment and...
Головоломка. Inside Out. (2016)
Райли — обычная 11-летняя школьница, и, как у каждого из нас, ее поведение определяют пять...