Python Dictionary get() Method

0
9K

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
Leia Mais
Спорт
Морской заговор: Тайна устойчивого рыболовства. Seaspiracy. (2021)
Все документальные события данного кинофильма от Netflix, который имеет название "Морской...
Por Nikolai Pokryshkin 2022-09-11 23:33:17 0 29K
Life Issues
Monsters, Inc. (2001)
In order to power the city, monsters have to scare children so that they scream. However, the...
Por Leonard Pokrovski 2023-04-09 18:48:30 0 22K
Социальные проблемы
Рождество кота Боба. A Christmas Gift from Bob. (2020)
До встречи с котом Бобом Джеймс не любил Рождество, но рыжий пушистый хулиган всё изменил. Он в...
Por Nikolai Pokryshkin 2022-10-05 17:02:02 0 21K
Social Issues
Die Hard. (1988)
A New York City police officer tries to save his estranged wife and several others taken hostage...
Por Leonard Pokrovski 2023-01-31 14:35:24 0 21K
Financial Services
Law of demand
Key points The law of demand states that a higher price leads to a lower...
Por Mark Lorenzo 2023-04-06 19:46:38 0 9K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov