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
إقرأ المزيد
effect of changes in policies and economic conditions on the foreign exchange market
Lesson summary
Changes in the supply of or demand for a currency will cause that...
What Happens When a Story Isn’t Completed in the Sprint?
Agile methodologies like Scrum emphasize delivering working software in short, iterative cycles...
Platoon. (1986)
Chris Taylor, a neophyte recruit in Vietnam, finds himself caught in a battle of wills between...
Are All Bank Accounts Insured by the FDIC?
Are All Bank Accounts Insured by the FDIC?
When people deposit their money into a bank, one of...
Advanced Elements That Strengthen a Pitch
A. The “Why Now?” — Timing Justification
A strong pitch explains why your idea...