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 Tools Are Commonly Used in Project Management?
Project management is a structured approach to planning, executing, and completing projects...
Can I Pay Off My Loan Early? What Happens If I Repay Ahead of Schedule?
Can I Pay Off My Loan Early? What Happens If I Repay Ahead of Schedule?
Managing a loan...
How perfectly competitive firms make output decisions
Key points
As a perfectly competitive firm produces a greater quantity of output,...
Большой Лебовски. The Big Lebowski. (1998)
Лос-Анджелес, 1991 год, война в Персидском заливе. Главный герой по прозвищу Чувак считает себя...
What Advice Would You Give to Aspiring Managers?
Stepping into a management role is an exciting milestone, but it also brings a new set of...