Python Dictionary get() Method
Сообщение 2023-03-07 22:06:39
0
7Кб
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
Больше
Star Wars: Episode V - The Empire Strikes Back. (1980)
After the Rebels are brutally overpowered by the Empire on the ice planet Hoth, Luke Skywalker...
Lua vs JavaScript
Sr. No
Lua
JavaScript
1
Lua is one of the cross-platform programming languages...
What is the Difference Between a Resume and a Business Biography?
In the professional world, both resumes and business biographies serve as tools to present an...
The Cove (2009)
Using state-of-the-art equipment, a group of activists, led by renowned dolphin trainer Ric...
What are the Tax Implications of Working Remotely?
As the global workforce increasingly shifts to remote work, understanding the tax implications of...