Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
4KB
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
Search
Nach Verein filtern
- Arts
- Business
- Computers
- Spiele
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
ADHD: In adults
Adults with ADHD are diagnosed under the same criteria, including that their signs must have been...
How the Python or Operator Works
With the Boolean OR operator, you can connect two Boolean expressions into one compound...
Logan. (2017)
In a future where mutants are nearly extinct, an elderly and weary Logan leads a quiet life. But...
Судная ночь навсегда. The Forever Purge. (2021)
Этим летом все правила будут нарушены. Группа мародеров решает, что ежегодная Судная ночь не...
"Freelancing offers special advantages": where to look for a part-time job for students
"Freelancing offers special advantages": where to look for a part-time job for students...