Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
6KB
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
Calm with Horses.(2020)
Douglas 'Arm' Armstrong has become the feared enforcer for the drug-dealing Devers family, whilst...
FYRE: Величайшая вечеринка, которая не состоялась. FYRE: The Greatest Party That Never Happened. (2019)
Музыкальный фестиваль FYRE на частном острове на Багамах должен был стать самой крутой и...
The Phillips curve in the Keynesian perspective
Key points
A Phillips curve shows the tradeoff between unemployment and inflation...
Is It Possible to Maintain a Full-Time Job While Pursuing Indie Hacking Projects?
In today’s world of side hustles, freelancing, and remote work, the idea of juggling a...
What Are the Key Components of a Business Strategy?
Developing a successful business strategy is a critical process for companies of all sizes,...