Python Dictionary get() Method
Posté 2023-03-07 22:06:39
0
4KB
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
Yard, Deck, and Table Games: Classic Fun for All Ages
Games have always been a great way to bring people together, whether you’re enjoying a...
The Evolution and Impact of Multimedia in Modern Communication
Introduction
In an era dominated by rapid technological advancements, multimedia has emerged as...
Omega Gospel Live TV. South African Republic.
OMEGA Gospel TV Network is a Christian-based broadcast platform that continuously airs a unique...
Events for Doctors
Events for Doctors
Medicine must be constantly evolving. Scientists are constantly discovering...
Мадам Клод. Madame Claude. (2021)
Париж, 1960-е. Мадам Клод возглавляет процветающий бизнес, связанный с проституцией, который дает...