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
إقرأ المزيد
What Are the Two Main Branches of Economics?
What Are the Two Main Branches of Economics?Microeconomics and Macroeconomics
Economics is a...
Paid, Owned, and Earned Media: The Three Pillars of Digital Marketing
Introduction: Why These Three Media Types Matter
Digital marketing is built on three core...
What Does PPC Stand For?
PPC is one of the most commonly used terms in digital marketing, yet many people encounter it...
How Living Expenses Shape the True Cost of Education
How Living Expenses Shape the True Cost of Education
When students plan for higher education,...
Intimacy. (2001)
A failed London musician meets once a week with a woman for a series of intense sexual encounters...