Python Dictionary get() Method
Сообщение 2023-03-07 22:06:39
0
10Кб
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
Больше
Why Do You Want to Work Here? Understanding a Candidate’s Motivation and Alignment
The question "Why do you want to work here?" is a staple in job interviews. It may sound simple,...
What Types of Startup Incubators Exist?
Startup incubators have become essential pillars in the global entrepreneurship ecosystem,...
Why the private sector under invests in innovation
Key points
New technology often has positive externalities—in other words,...
Оккупант. The Occupant. (2020)
Хавьер Муньос, когда-то успешный руководитель, принимает решение покинуть свой дом, который он и...
The Invisible Maniac. (1990)
An invisible scientist escapes from an asylum and teaches high-school physics to nubile teens....