Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
11K
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
- Arts
- Business
- Computers
- Giochi
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leggi tutto
Embracing Diversity: Enriching Society through Ethnicity
In the tapestry of humanity, ethnicity weaves a colorful and diverse pattern, enriching the...
Mank (2020)
In 1940, film studio RKO 1940 hires 24-year-old wunderkind Orson Welles under a contract that...
Why Is Thought Leadership Important?
In today's competitive professional landscape, being good at what you do is no longer enough. To...
Терминатор. The Terminator. (1984)
История противостояния солдата Кайла Риза и киборга-терминатора, прибывших в 1984-й год из...
Europe: A Tapestry of Culture, History, and Diversity
Europe: A Tapestry of Culture, History, and Diversity
Europe, the cradle of Western...