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
إقرأ المزيد
Exploring the World of Arts and Crafts: A Creative Journey
Arts and crafts have been a cherished part of human culture for centuries, blending creativity...
How Do I Plan a Budget So I Know How Much I Can Afford to Spend?
How Do I Plan a Budget So I Know How Much I Can Afford to Spend?
How to Budget First, Then...
What is APR on a Credit Card?
What is APR on a Credit Card?
When you’re comparing credit cards, one of the most...
What Is a Debit Card?
What Is a Debit Card?
A debit card is a widely used financial tool that allows individuals to...
How Much Foreign Currency Can One Carry Abroad? Understanding Forex Limits
How Much Foreign Currency Can One Carry Abroad? Understanding Forex Limits
Traveling...