Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
10K
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 Can I Improve My Mindset?
Your mindset is the lens through which you view the world. It influences how you respond to...
Мадам Парфюмер. Perfumes. (2020)
Анна Вальберг — знаменитость в мире парфюмерии. Она живет как дива, ведет себя как эгоистка...
How Transparent Are Startup CEOs with Their Teams?
Transparency is more than a leadership buzzword—it’s a defining trait of effective...
What Is the Scope—And How Will We Measure It?
Determining Boundaries and Success Metrics for the Project**
Project scope defines the...
Best Conflict Resolution Questions for Students
Conflict is a natural part of student life, whether it happens in the classroom, during group...