Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
11KB
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
Doctors create a database of DNA residents of New York: why is it necessary
This week, Mount Sinai Health System began work to create an extensive database of patients'...
The World of Professional Sports: A Glimpse into Its Impact and Evolution
The World of Professional Sports: A Glimpse into Its Impact and...
Within Project Management: Frequently Asked Questions (FAQs)
Project management is the structured approach to planning, executing, and finalizing projects...
The most beautiful places in North America
North America is the third largest continent on our planet. It stretches from the polar latitudes...
What Leadership Qualities Does the CEO Possess?
A CEO's leadership qualities are among the most defining elements of their effectiveness. Great...