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
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
إقرأ المزيد
Why is the Issue of Sustainability Important for Development?
Sustainability is one of the most pressing issues facing global development today. As the world...
How Do I Speak Confidently During a Presentation?
Confidence during a presentation isn’t something you’re born with — it’s...
Psychosis: Medication
Administration, or sometimes withdrawal, of a large number of medications may provoke psychotic...
How to Write a Press Release That Journalists Actually Use
Introduction: The Harsh Truth About Press Releases
Every day, journalists’ inboxes fill...
How Do Time Spans Affect Our Understanding of Growth?
Growth is not a single, uniform process. Its meaning and significance shift dramatically...