Python Dictionary get() Method
Posted 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
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
Terminator 2: Judgment Day. (1991)
A cyborg, identical to the one who failed to kill Sarah Connor, must now protect her 10-year old...
What Are Real-Life Examples of Fintech Services and Companies?
What Are Real-Life Examples of Fintech Services and Companies?
Financial technology, or fintech,...
How Do You Create or Develop a Product Strategy?
A well-crafted product strategy is the cornerstone of every successful product. Without it, teams...
Dream Horse (2021)
Dream Alliance is an unlikely race horse bred by small-town Welsh bartender Jan Vokes. With no...
Usenet
Usenet is a computer network used for communication and...