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
إقرأ المزيد
How Do I Develop a Business Strategy?
Developing a business strategy is essential for guiding an organization toward its long-term...
Blade Runner. (1982)
A blade runner must pursue and terminate four replicants who stole a ship in space and have...
How Can I Start Developing My Leadership Skills?
Leadership is not just a position—it's a practice. Whether you’re a student,...
Before Sunset. (2004)
Nine years after Jesse and Celine first met, they encounter each other again on the French leg of...
Understanding Ethnicity: Its Significance, Dimensions, and Impact
Ethnicity is a complex and multifaceted concept that plays a central role in shaping individuals'...