Python Dictionary get() Method
Posté 2023-03-07 22:06:39
0
11KB
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
Rechercher
Catégories
- Arts
- Business
- Computers
- Jeux
- Health
- Domicile
- Kids and Teens
- Argent
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Lire la suite
What Is Personal Development and Why Is It Important?
In today’s fast-paced world, personal development has become more than a...
What Is a Social Enterprise?
In today’s world, more businesses are being built not just to generate profit—but to...
LiveNOW from FOX Live TV USA
Raw & unfiltered news. Watch a non-stop stream of breaking news, live events and stories...
User Agreement for Games (EULA), why and how it is drawn up
Most likely, each of us at least once in his life when first launching an application or game...
How Much Time and Resources Does Social Media Marketing Require?
Social media marketing is one of the most powerful tools for building a brand, driving...