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 economics of pollution
Key Points
Economic production can cause environmental damage. This tradeoff...
Who Should Be Invited to the Meeting?
Why Selecting the Right Participants Drives Better Results
Meetings are an essential part of...
What Is a Marketing Plan (And How to Build One That Actually Works)
Introduction: Why Every Business Needs a Marketing Plan
If you’ve ever wondered why some...
How Do they celebrate the new years in Africa?
Connection between the calendar and natural phenomena, new Year's rituals of Africans and the...
Product Management vs. Project Management (or vs. Product Ownership or Product Marketing)?
Although the terms are often confused, product management, project management, product ownership,...