Python Dictionary get() Method
Postado 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
Pesquisar
Categorias
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia mais
SMNI News (English) Live TV Philippines
Sonshine Media Network International (SMNI), is the official broadcasting arm of the Kingdom of...
Why is economic growth important?
Why Is Economic Growth Important?
The Prosperity We Notice—and the Prosperity We Take for...
How Do I Report a Change of Address or Name to Social Security?
How Do I Report a Change of Address or Name to Social Security?
Marriage, Divorce, Relocation,...
What Is a Good Credit Score?
What Is a Good Credit Score?
Your credit score is one of the most important numbers in your...
Человек-паук: Нет пути домой. Spider-Man: No Way Home. (2021)
Жизнь и репутация Питера Паркера оказываются под угрозой, поскольку Мистерио раскрыл всему миру...