Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
12KB
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
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia mais
How Much Time Does It Take to Work With Analytics Tools?
Analytics tools have become an essential part of modern business decision-making. Whether...
What Can Telemarketing Be Used For (and When Is It Effective)? Understanding Applications, Strategy, and Impact
Introduction
Telemarketing has long been a cornerstone of direct marketing, offering businesses...
Seaspiracy 2021
Passionate about ocean life, a filmmaker sets out to document the harm that humans do to marine...
The most famous amusement parks
Amusement parks in the modern world are a favorite vacation spot for families with children, fans...
How Do I Handle Negative Feedback?
Strategies to Receive and Respond to Criticism Positively and Productively
Receiving negative...