Python Dictionary get() Method
Posté 2023-03-07 22:06:39
0
12KB
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
The Timeless Appeal of Golf: A Sport that Challenges and Inspires
Golf, often referred to as the "gentleman's game," holds a unique place in the world of sports....
What Should I Write About on My Blog? (Finding Topics That Attract and Engage Readers)
One of the most common challenges bloggers face is deciding what to write about. Even after...
Corporate Merch and why its needed
Corporate merchandise is a product or product that a brand or company creates and distributes...
How Can I Save Money Fast? A Practical Guide to Building Cash Quickly
How Can I Save Money Fast? A Practical Guide to Building Cash Quickly
Saving money quickly is...
Бен-Гур. Ben-Hur. (1959)
Действие фильма начинается в Палестине в 26 году от Рождества Христова. Два друга, иудей Бен Гур...