Python Dictionary get() Method
Veröffentlicht 2023-03-07 22:06:39
0
10KB
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
Suche
Kategorien
- Arts
- Business
- Computers
- Spiele
- Health
- Startseite
- Kids and Teens
- Geld
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Mehr lesen
What is philosophy?
Life, science and culture in general require from us and, above all, from young people,...
Search engine promotion: how it works
Introduction to search engine promotionSearch engine promotion (SEO) is the process of optimizing...
The Good, the Bad and the Ugly. (1966)
A bounty hunting scam joins two men in an uneasy alliance against a third in a race to find a...
The Vault (2021)
Follows a genius engineering graduate who is interested in the Bank of Spain's safe.
My Link
Is a Facilitator or Chair Needed? Understanding the Role of Meeting Moderators
In many organizations, meetings can either drive momentum or drain productivity. One of the...