Python Dictionary get() Method
Сообщение 2023-03-07 22:06:39
0
12Кб
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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Больше
Penguin Bloom 2021
Based on the best-selling book of the same name, the film tells the story of Sam Bloom (Academy...
How Do I Create a Budget?
How Do I Create a Budget?
Creating a budget is one of the most powerful steps you can take to...
How to Adapt Etiquette for Different Cultures or Social Contexts: A Comprehensive Professional Guide
In our increasingly interconnected world, professional and social interactions often span...
What Happens If I Get Counterfeit Currency?
What Happens If I Get Counterfeit Currency?
Imagine this: you withdraw some cash from your bank,...
Can AI improve demand forecasting in industries like fashion?
In the fast-paced world of fashion, accurately predicting demand can be a significant challenge....