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
إقرأ المزيد
Problems of Ethics and Security in the Information System
Information systems have made many businesses successful today. Some companies, such as Google,...
Ruby Web Scraping
This post covers the main tools and techniques for web scraping in Ruby. We start with an...
What Are the Key Types of Business Strategies?
Business strategy is an essential part of any organization’s long-term success. It involves...
What Role Did Advertising Pioneers Play in Modern Marketing?
Modern marketing did not emerge fully formed. It evolved through experimentation, debate,...
How to Choose Investments and Build the Right Portfolio for You
How to Choose Investments and Build the Right Portfolio for You
When people first begin...