Python Dictionary get() Method
Сообщение 2023-03-07 22:06:39
0
7Кб
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
Поиск
Категории
- Arts
- Business
- Computers
- Игры
- Health
- Главная
- Kids and Teens
- Деньги
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Больше
Network marketing and pyramid schemes: what is the difference
The temptation to have extra income often outweighs common sense. Wanting to make quick money,...
Exploring the Charm of Craft Shopping: A Journey into Creativity and Authenticity
Exploring the Charm of Craft Shopping: A Journey into Creativity and Authenticity
In the...
How Do Entrepreneurs Get Funding?
Starting a business requires capital, and many entrepreneurs face the challenge of securing...
Penguin Bloom 2021
Based on the best-selling book of the same name, the film tells the story of Sam Bloom (Academy...
The Art of Animation: A Journey Through Motion and Imagination
Animation has evolved from simple sketches to complex digital masterpieces, captivating audiences...