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
إقرأ المزيد
What If Scope or Requirements Change Mid-Project? Handling Scope Creep: Assess Impact, Communicate Changes, Update Plan
In an ideal world, project requirements stay fixed from start to finish. But in reality, change...
Top 10 economies in terms of GDP by 2038
Top 10 economies in terms of GDP by 2038
In 2024, global...
What to give parents for their birthday: tips for choosing a gift
Adult children can no longer give their parents a simple card, a bouquet of flowers, or something...
Pittsburgh Faith & Family. Live TV.
The Pittsburgh Faith & Family Channel brings the truth of the Good News directly into your...
Tenet(2020)
Armed with only one word, Tenet, and fighting for the survival of the entire world, a Protagonist...