Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
12KB
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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia mais
How Does Mentoring Differ from Coaching?
Mentoring and coaching are often used interchangeably, but they are fundamentally different in...
Flags
A flag is a piece of fabric (most often rectangular or quadrilateral) with a distinctive design...
Is Lean Startup Applicable Only to Tech Companies?
The Lean Startup methodology, popularized by Eric Ries, is often associated with technology...
Autism Spectrum: Repetitive Behaviours
ASD includes a wide variety of characteristics. Some of these include behavioral characteristics...
Senna (2010)
A documentary on Brazilian Formula One racing driver Ayrton Senna, who won the F1 world...