Python Dictionary get() Method
Posted 2023-03-07 22:06:39
0
4K
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
Tourists went into outer space for the first time in history. How this industry is developing
On September 12, the first ever tourist spacewalk took place. As part of the private mission...
7 Tips for Buying Consumer Electronics Online
Buying consumer electronics via the Internet is quite simple – potential buyers of goods...
Navigating the Complexities of Disability in Modern Society
Navigating the Complexities of Disability in Modern Society
Introduction:In the mosaic of human...
Unforgiven. (1992)
Retired Old West gunslinger William Munny reluctantly takes on one last job, with the help of his...
The secret of eternal youth. What are the causes of human aging and death?
We age for a reason, but as a result of a special biological program. But there is an African...