Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
11KB
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
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia mais
Make A 2D Game With Unity
How to Create a 2D Game in Unity
To create 2D games, we need to use Unity Hub. Unity...
What Should a Telemarketing Campaign Cost — and How Do You Budget It?
Introduction
Telemarketing remains one of the most direct and measurable forms of customer...
40 Top Job Interview Questions (and How to Answer Them)
Job interviews can be nerve-wracking, but preparation makes all the difference. Whether...
Unveiling Earth's Secrets: Exploring the Wonders of Earth Sciences
Unveiling Earth's Secrets: Exploring the Wonders of Earth Sciences
Earth, our home planet, is a...
The Ultimate Guide to Shopping for Your Dream Wedding: Making Every Moment Memorable
Shopping for your wedding can be both exhilarating and overwhelming. From finding the perfect...