Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
12K
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
Buscar
Categorías
- Arts
- Business
- Computers
- Juegos
- Health
- Home
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
What certifications matter most?
What Certifications Matter Most?
Certifications sit in an awkward space between signal and...
Law of supply
Key points
The law of supply states that a higher price leads to a higher...
What Is the Difference Between Corporate Social Responsibility (CSR) and Social Enterprise Operations?
In today's business world, addressing social and environmental issues has become more than just a...
Income inequality debate
Income Inequality Debate
Income inequality is one of the most discussed economic and social...
How does work-life balance affect productivity?
How Does Work-Life Balance Affect Productivity?
Work-life balance is often discussed as a...