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
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
LGBTQIA+
LGBT is an acronym for lesbian, gay, bisexual, and transgender people. It appeared in English in...
What Are Your Biggest Frustrations in Analytics?
Analytics is often seen as the engine behind modern business decision-making. Organizations...
What Is Corporate Social Responsibility (CSR)?
Corporate Social Responsibility (CSR) refers to a company’s commitment to managing its...
Perfect competition and why it matters
Key points
A perfectly competitive firm is a price taker, which means that it...
What Type of Legal Structure Should Our Partnership Have?
Choosing the right legal structure is one of the most important decisions you’ll ever make...