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
Больше
Джон Уик 4. John Wick: Chapter 4. (2023)
Джон Уик находит способ одержать победу над Правлением кланов. Но прежде ему предстоит сразиться...
The Backbone of Sports Excellence: A Look into Sports Organizations
The Backbone of Sports Excellence: A Look into Sports Organizations
Sports organizations serve...
Pulp Fiction. (1994)
The lives of two mob hitmen, a boxer, a gangster and his wife, and a pair of diner bandits...
What is Business Strategy? A Clear Definition and Examples
Business strategy is a crucial concept that defines how a company will achieve its long-term...
Exploring the Evolution and Importance of Public Shopping Spaces
Exploring the Evolution and Importance of Public Shopping Spaces
In the bustling tapestry of...