Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
6K
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
Căutare
Categorii
- Arts
- Business
- Computers
- Jocuri
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Citeste mai mult
Бойцовский клуб. Fight Club. (1999)
Сотрудник страховой компании страдает хронической бессонницей и отчаянно пытается вырваться из...
Comics
To help beginners, we publish a list of terms that are used by experienced comic book readers....
Why does a start-up business need marketing?
Why does a start-up business need marketing?
It seems that the English-language term...
Germany is the birthplace of nudism.
Germany, indeed, is powerfully connected with the culture of the naked body. Between 8 and 12...
The Last Vermeer (2020)
Claes Bang (THE SQUARE) stars as Joseph Piller in this captivating dramatic thriller set just...