Python Dictionary get() Method
Posted 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
Site içinde arama yapın
Kategoriler
- Arts
- Business
- Computers
- Oyunlar
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
Друзья на свою голову. A Friendly Tale... (2020)
Леа и Марк, Карин и Франсис – две пары закадычных друзей. Но когда скромная тихоня Леа...
Network marketing and pyramid schemes: what is the difference
The temptation to have extra income often outweighs common sense. Wanting to make quick money,...
Pharmacy in the USA
Pharmacy in the USA
Retail trade in medicines in the USA is a huge market,...
What Traits or Qualities Define a Great Leader?
Great leaders combine vision, empathy, and strategic thinking to guide teams toward success....
What are the current trends in content creation, and how can I incorporate them?
In the world of content creation, staying ahead of trends is crucial for maintaining relevance...