Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
9كيلو بايت
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
إقرأ المزيد
The Timeless Appeal of Golf: A Sport that Challenges and Inspires
Golf, often referred to as the "gentleman's game," holds a unique place in the world of sports....
How to choose the perfect outfit for the office: style tips
Choosing the perfect outfit for the office can be challenging, especially if you want to look...
What Are the Project Requirements and Deliverables?
Defining What Needs to Be Delivered, How, and to What Quality Standards**
Once the...
What is Sustainability?
Sustainability has become one of the most significant concepts of the modern era. With growing...
Python setup.py
setup.py is a python file, the presence of which is an indication that the module/package...