Python Dictionary get() Method
Posted 2023-03-07 22:06:39
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
Buscar
Categorías
- Arts
- Business
- Computers
- Juegos
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
Python OverflowError
Raised when the result of an arithmetic operation is too large to be represented. This cannot...
The Art of Listening: Exploring the Recreation of Audio
The Art of Listening: Exploring the Recreation of Audio
Introduction: In a world inundated with...
Касабланка. Casablanca. (1942)
Оставивший родину американец Рик Блэйн, владелец игорного клуба в Касабланке, встречается с...
Misbehaviour. (2020)
A group of women hatch a plan to disrupt the 1970 Miss World beauty competition in London.
My...
Macroeconomics
If you want to sum up what economics means, you could do so with the following statement:...