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
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Больше
How Do I Present Online or Virtually?
Virtual presenting has become a normal part of school, work, clubs, and even social projects....
Амадей. Amadeus. (1984)
1781 год. Антонио Сальери успешно справляется с обязанностями придворного композитора при...
How Do I Save Money for a House Down Payment?
How Do I Save Money for a House Down Payment?
Buying a home is one of the biggest financial...
How does the CEO handle failure? Insights into the CEO's approach to setbacks can offer valuable lessons in resilience and adaptability.
In the high-stakes world of corporate leadership, failure is inevitable. Even the most successful...
LiveNOW from FOX Live TV USA
Raw & unfiltered news. Watch a non-stop stream of breaking news, live events and stories...