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
Больше
LLC or Small Business?
LLC or Small Business?
Deductions, Write-Offs, Pass-Through Taxation, and S-Corp Benefits...
Is AdSense Allowed on Blogs, WordPress, and YouTube?
One of the most common questions beginners ask is whether Google AdSense is allowed on blogs,...
History of Information Technology
The history of information technology dates back to long before the emergence of the modern...
The Art and Science of Picture Ratings: Understanding Recreation Through Visual Evaluation
The Art and Science of Picture Ratings: Understanding Recreation Through Visual Evaluation
In...
How Would You Describe Your Management or Leadership Style?
One of the most common and insightful questions in leadership and management discussions is:...