Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
6K
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
SMNI News (English) Live TV Philippines
Sonshine Media Network International (SMNI), is the official broadcasting arm of the Kingdom of...
Happiest Countries in the World
Since 2002, the World Happiness Report has used statistical analysis to determine the world's...
10 interesting facts about chemistry
For many, weekdays are almost monotonous: home, work, home ... And often this drives people into...
Schindler's List. (1993)
In German-occupied Poland during World War II, industrialist Oskar Schindler gradually becomes...
How to make money on Google AdSense without a website
If you've ever visited forums like Reddit or Quora, you may have seen questions like, "How can I...