Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
12كيلو بايت
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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
إقرأ المزيد
How Do You Handle Underperforming Employees?
Managing underperformance is one of the more delicate challenges a manager can face. An...
What is Decision Analysis?
The Use of Decision Trees and Quantitative Methods for Evaluating Choices Under Uncertainty...
Rabbit salad with ham, rice, corn and cucumber
Surprise guests with an unusual dish for the New Year. Salad "Rabbit" with corn, rice and ham, as...
What Skills Do Headhunters Need?
In the contemporary labor market, the role of headhunters—also known as executive...
What is the Difference Between a Checking Account and a Savings Account?
What is the Difference Between a Checking Account and a Savings Account?
When it comes to...