Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
7كيلو بايت
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
إقرأ المزيد
Drew Houston
Drew Houston
Drew Houston
Andrew W. "Drew" Houston
Date of...
How Do I Build a Strong Startup Team?
A great idea can spark a startup, but a great team makes it thrive. In the fast-paced world of...
Catch Me If You Can. (2002)
Barely 21 yet, Frank is a skilled forger who has passed as a doctor, lawyer and pilot. FBI agent...
Explicit and implicit costs and accounting and economic profit
Key points
Privately owned firms are motivated to earn profits. Profit is the...
What daily habits do successful founders have?
Success in the startup world rarely happens by accident. Behind every thriving founder is a set...