Python Dictionary get() Method
Postado 2023-03-07 22:06:39
0
12KB
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
What’s Not Working?
One of the most powerful yet uncomfortable questions in personal growth, career development, or...
49 канал прямая трансляция.
«НСК 49» – новосибирский телеканал. Новости, кино, шоу, музыка –...
Python Regex
A RegEx, or Regular Expression, is a sequence of characters that forms a search...
How Do Business Consultants Identify the Needs of a Company?
Business consultants play a crucial role in helping companies identify their needs, challenges,...
What is a Startup Founder?
A startup founder is an entrepreneur who creates and establishes a new business venture,...