Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
11K
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 Organizations Foster a Culture of Innovation?
In today’s rapidly evolving business landscape, innovation is not just a luxury but a...
What is APR? How Do Interest Rates Work?
What is APR? How Do Interest Rates Work?
When it comes to borrowing money, whether through a...
How Do I Set Motivating, Aligned Goals?
Goal-setting is more than a planning exercise—it’s a powerful engine for motivation,...
Время. Old. (2021)
Отправившись в отпуск на тропический остров, семья с двумя детьми решает последовать совету...
Volleyball
Volleyball (English volleyball from volley - "blow from the flight" and ball - "ball") is a...