Python Dictionary get() Method
نشر بتاريخ 2023-03-07 22:06:39
0
6كيلو بايت
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 Grand Budapest Hotel. (2014)
Фильм рассказывает об увлекательных приключениях легендарного консьержа Густава и его юного...
Кубань 24 Прямая трансляция.
«Кубань 24» — единственный в Краснодарском крае телеканал, который осуществляет...
Raspberry PI Pros & Cons
Five Pros
5. Vast Peripheral Support
Raspberry Pi comes with 26 GPIO Pins which are very useful...
Play by mail
Play by mail games (also known asPBM games,PBEM games or turn-based games) is a gameplayed via...
The Timeless Appeal of Bocce: A Game of Skill, Strategy, and Social Connection
In the realm of leisurely outdoor activities, few games blend simplicity with strategic depth as...