Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
5K
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
Search
Categories
- Arts
- Business
- Computers
- Games
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
FYRE: The Greatest Party That Never Happened. (2019)
An exclusive behind the scenes look at the infamous unraveling of the Fyre music festival.
My...
Metropolis. (1927)
In a futuristic city sharply divided between the working class and the city planners, the son...
Art and Entertainment: The Intersection of Creativity and Enjoyment
Art and entertainment have long been intertwined, forming a symbiotic relationship that enriches...
ABC News Live TV USA
ABC News is your daily news outlet for breaking national and world news, video news, exclusive...
Women Health
Women's health is the most valuable thing that every representative of the fair half of humanity...