Python Dictionary get() Method

0
4KB

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
Sport
Sisters on Track (2021)
A coming of age story about hope, belonging, and the metaphorical and literal sisterhood of young...
Por Leonard Pokrovski 2022-09-02 18:21:53 0 19KB
История
Ран. Ran. (1985)
Япония, XVI век. Стареющий правитель Хидэтора объявляет о разделе своих владений между тремя...
Por Nikolai Pokryshkin 2023-02-11 19:18:08 0 12KB
Mental Health
ADHD: Behavioural therapies
There is good evidence for the use of behavioural therapies in ADHD. They are the recommended...
Por Kelsey Rodriguez 2023-04-27 17:37:46 0 4KB
Greyhound Racing
The Controversy and Legacy of Greyhound Racing: A Closer Look
The Controversy and Legacy of Greyhound Racing: A Closer Look Greyhound racing has long been a...
Por Leonard Pokrovski 2024-06-27 19:00:08 0 10KB
Social Issues
The Shawshank Redemption. (1994)
Chronicles the experiences of a formerly successful banker as a prisoner in the gloomy jailhouse...
Por Leonard Pokrovski 2022-10-30 19:43:08 0 15KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov