Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
11كيلو بايت
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
البحث
الأقسام
- Arts
- Business
- Computers
- الألعاب
- Health
- الرئيسية
- Kids and Teens
- مال
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
إقرأ المزيد
The Production Possibilities Frontier
Key Points
The Production Possibilities Frontier (PPF) is a graph that shows all the...
Key Elements of Explorers' Journals
Explorers' journals are an essential part of the history of exploration, providing firsthand...
5 reasons to work if you already have enough money
Many work primarily for money.But this is not everyone's only motivation. Many people advise...
How Many Slides Should a Pitch Deck Have?
One of the most common questions among founders, entrepreneurs, and professionals preparing...
ADHD: Suicide Risk
Systematic reviews conducted in 2017 and 2020 found strong evidence that ADHD is associated with...