Python Dictionary get() Method
Veröffentlicht 2023-03-07 22:06:39
0
13KB
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
Suche
Kategorien
- Arts
- Business
- Computers
- Spiele
- Health
- Startseite
- Kids and Teens
- Geld
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Mehr lesen
Financial Services in the USA: An Overview of a Vital Sector
The financial services industry is one of the most crucial sectors in the United States economy....
What is a living wage?
What Is a Living Wage?
A living wage is the amount of money a worker needs to earn to afford a...
How Do Creators Monetize Communities?
A surprisingly large number of creators begin with the wrong question.
They ask:
"How can I...
Problems of working with personnel at enterprises and how to solve them
The success of the company depends on employees. An increasing number of managers are aware of...
What is the federal funds rate?
What Is the Federal Funds Rate?
The federal funds rate is one of the most important interest...