Python Dictionary get() Method
Сообщение 2023-03-07 22:06:39
0
13Кб
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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Больше
Science Educational Sources: Empowering Learning and Discovery
In today’s rapidly advancing world, science education is more important than ever. From...
The Rise of Online Shopping: A Comprehensive Overview
In recent years, online shopping has transformed the way consumers purchase goods and services....
How does income inequality affect opportunity?
How Does Income Inequality Affect Opportunity?
Income inequality refers to the uneven...
How Do You Handle Underperforming Employees?
Managing underperformance is one of the more delicate challenges a manager can face. An...
Company Information Security
From cybersecurity solutions to risk management systems, these services are tailored to meet the...