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
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Διαβάζω περισσότερα
What Is a Loan?
What Is a Loan?
A Comprehensive Guide to Understanding Borrowing, Interest, and Repayment...
Common Etiquette Rules in the Business Environment
Business etiquette is more than a set of formalities — it is a framework for building...
How Did Famous Advertisers Start Their Careers?
Many of the most famous names in advertising did not begin their careers with clear plans to...
Archery
Archery is an Olympic sport in which athletes compete in archery accuracy. The winner in...
Painting Schools
We are often approached by students who want to study fine arts and subsequently find a...