Python Dictionary get() Method
Postado 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
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
Touching the Void (2003)
The true story of two climbers and their perilous journey up the west face of Siula Grande in the...
What Advice Would You Give to Aspiring Managers?
Stepping into a management role is an exciting milestone, but it also brings a new set of...
ADHD: Neurotransmitter pathways
Previously, it had been suggested that the elevated number of dopamine transporters in people...
Why is Minecraft such a good game?
Introduction:
Minecraft is a game that has proven to have longevity, no matter what game is the...
The Great Dictator. (1940)
Dictator Adenoid Hynkel tries to expand his empire while a poor Jewish barber tries to avoid...