Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
13K
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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
What Are Retail Operations?
The Store That Sold More by Doing Less
The sales numbers looked strong.
Customer traffic was...
How do I stop procrastinating?
How Do I Stop Procrastinating?
Procrastination is not simply laziness or poor...
What are the best brainstorming techniques?
What Are the Best Brainstorming Techniques?
The Assumption Beneath the Exercise
Brainstorming...
Harry Potter 20th Anniversary: Return to Hogwarts (2022)
Cast members from all "Harry Potter" films reunite in a retrospective special to celebrate the...
How to Track Customer Behavior Without Losing Sight of the Human Behind the Data
A few years ago, I sat in a meeting where someone proudly announced that the company now had...