Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
4K
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
Cerca
Categorie
- Arts
- Business
- Computers
- Giochi
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leggi tutto
The Importance of Construction and Maintenance in Modern Infrastructure
Construction and maintenance are two fundamental pillars that ensure the functionality, safety,...
A Teacher. (2013)
A high school teacher in Austin, Texas takes sexual advantage over one of her students. Her life...
Мулан. Mulan. (2020)
Изданный императором Китая указ о призыве на службу в армии одного мужчины из каждой семьи для...
Unveiling the World of Strength Sports: Power, Precision, and Passion
Unveiling the World of Strength Sports: Power, Precision, and Passion
Strength sports have...
Python Steam API
python-steam-api is a Python library wrapper for the web API Steam. It provides many functions...