Python Dictionary get() Method
Δημοσιευμένα 2023-03-07 22:06:39
0
9χλμ.
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
Διαβάζω περισσότερα
The Incredible Story of Board Games
The oldest "tabletops" appeared more than five thousand years ago and passed an interesting path...
Python Fun Fact
There's a fact about Python that you might not know! Python has a module called "this". The...
Psychosis: Medication
Administration, or sometimes withdrawal, of a large number of medications may provoke psychotic...
The structure of costs in the short run
Key points
Looked at from a short-run perspective, a firm’s total costs can...
Python lavalink.py
Lavalink.py is a wrapper for Lavalink which abstracts away most of the code necessary to use...