Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
9K
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
Căutare
Categorii
- Arts
- Business
- Computers
- Jocuri
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Citeste mai mult
FOX 43 Live TV, York, Pennsylvania, USA.
FOX43+ features the latest breaking news and weather, plus daily talk shows, coverage of your...
How to budget properly
Saving money can be a straightforward process if you approach it with some planning and...
Shutter Island. (2010)
In 1954, a U.S. Marshal investigates the disappearance of a murderer who escaped from a hospital...
ABC Action News. WFTS Tampa Bay, Florida, USA.
WFTS-TV is an ABC-affiliated television station located in Tampa, Florida, United States. It is...
The Dark Knight. (2008)
When the menace known as the Joker wreaks havoc and chaos on the people of Gotham, Batman must...