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
إقرأ المزيد
Infrastructure as a Service (IaaS): Virtual Infrastructure Delivery
Infrastructure as a Service (IaaS) is a cloud service model that allows you to rent virtual...
Man on Wire (2008)
A look at tightrope walker Philippe Petit's daring, but illegal, high-wire routine performed...
История Игрушек. Большой побег. Toy Story 3. (2010)
Энди почти 18 лет, ему остаётся 3 дня до отправки в колледж, в то время как его игрушки, в том...
Земля кочевников. Nomadland. (2020)
После закрытия завода по производству гипсокартона в январе 2011 года 60-летняя женщина Ферн...
The Joy of Home Gardening: Cultivating Your Green Thumb
Home gardening has gained immense popularity in recent years, and for good reason. Whether you...