Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
12K
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 Do CEOs Make Decisions in High-Pressure or Uncertain Situations?
CEOs often face decision-making moments under extreme pressure and uncertainty—whether...
Google ads - Youtube ads
Part 5: Google Shopping / Google ads (bigmoney.vip)
YouTube advertising in numbers
YouTube is...
Homosexuality in Europe
MEPs by a majority vote on March 11 adopted a declaration declaring the European Union an "LGBTI...
Casino. (1995)
A tale of greed, deception, money, power, and murder occur between two best friends: a mafia...
The Wolf of Wall Street. (2013)
Based on the true story of Jordan Belfort, from his rise to a wealthy stock-broker living the...