Python Dictionary get() Method

0
6كيلو بايت

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
البحث
الأقسام
إقرأ المزيد
Другое
Отель «Гранд Будапешт». The Grand Budapest Hotel. (2014)
Фильм рассказывает об увлекательных приключениях легендарного консьержа Густава и его юного...
بواسطة Nikolai Pokryshkin 2023-03-24 11:02:30 0 18كيلو بايت
Телевидение
Кубань 24 Прямая трансляция.
«Кубань 24» — единственный в Краснодарском крае телеканал, который осуществляет...
بواسطة Nikolai Pokryshkin 2022-10-28 16:52:44 0 19كيلو بايت
Programming
Raspberry PI Pros & Cons
Five Pros 5. Vast Peripheral Support Raspberry Pi comes with 26 GPIO Pins which are very useful...
بواسطة Jesse Thomas 2023-07-05 22:49:05 0 9كيلو بايت
Play-By-Mail
Play by mail
Play by mail games (also known asPBM games,PBEM games or turn-based games) is a gameplayed via...
بواسطة FWhoop Xelqua 2022-11-30 16:44:37 0 15كيلو بايت
Bocce
The Timeless Appeal of Bocce: A Game of Skill, Strategy, and Social Connection
In the realm of leisurely outdoor activities, few games blend simplicity with strategic depth as...
بواسطة Dacey Rankins 2024-06-17 18:49:35 0 11كيلو بايت
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov