Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
9كيلو بايت
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
إقرأ المزيد
Chocolate and its history
The history of chocolate began in Mesoamerica. Fermented beverages made from chocolate date back...
Revelation Live TV. United Kingdom.
Our Mission is to use Media to strengthen the Christian voice and impact the nations, with the...
The Power of Music: A Universal Language of Emotion and Expression
Music has been a cornerstone of human culture for millennia, transcending borders, languages, and...
How changes in the cost of living are measured
Key points
The Consumer Price Index, or CPI is a measure of...
What is financial planning, why is it needed and how to do it correctly
What is financial planning, why is it needed and how to do it correctly
Business...