Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
7K
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
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
Bootstrap
How do I add Bootstrap to my page?
Adding bootstrap to your page is a fast process, just add the...
Комната. Room. (2015)
Джой похитил маньяк, когда она была подростком. С тех пор она живет в крохотной комнатке вместе с...
Gardening
HORTICULTUREAmong all branches of crop production, a special place is given to horticulture. This...
The 10 most environmentally friendly countries
The site for expats InterNations interviewed about 15 thousand people who left their home...
Psychosis: Neurobiology
Psychosis has been traditionally linked to the overactivity of the neurotransmitter dopamine. In...