Python Dictionary get() Method
Δημοσιευμένα 2023-03-07 22:06:39
0
6χλμ.
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
Αναζήτηση
Κατηγορίες
- Arts
- Business
- Computers
- Παιχνίδια
- Health
- Κεντρική Σελίδα
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Διαβάζω περισσότερα
Python super()
super() lets you avoid referring to the base class explicitly, which can be nice. But the main...
The Evolution of Software: Transforming Our World
Software is an essential component of modern technology, acting as the invisible backbone that...
Унесённые ветром. Gone with the Wind. (1939)
Могучие ветры Гражданской войны в один миг уносят беззаботную юность южанки Скарлетт О`Хара,...
Last Christmas. (2019)
Kate is a young woman subscribed to bad decisions. Working as an elf in a year round Christmas...
The Only Video You Need to Start Manipulating Energy RIGHT NOW! (full guide)
In the video titled "The Only Video You Need to Start Manipulating Energy," published on February...