Remove Keys from Dictionary - Python

0
6K

In order to delete keys from the diction, you would have to use 'del'. Here's an example:

x  = {123: 456}

del x[123]

print(x)

>> {}

 

If the key doesn't exist in the dictionary, it'll throw an KeyError exception. 

Search
Categories
Read More
Mental Health
Autism Spectrum: Diagnosis Pt. 2
Ideally the diagnosis of ASD should be given by a team of clinicians (e.g. pediatricians, child...
By Kelsey Rodriguez 2023-03-03 18:22:53 0 7K
Научная фантастика и фэнтези
Метрополис. Metropolis. (1927)
Метрополис - город будущего, разделен на две части. Под землей находятся жилища рабочих, над ними...
By Nikolai Pokryshkin 2023-01-28 17:51:11 1 15K
Business
Marketing metrics: what metrics are important to track
Marketing metrics: what metrics are important to track In this article, we will talk...
By Leonard Pokrovski 2024-08-22 17:38:22 0 13K
Социальные проблемы
Лицо со шрамом. Scarface. (1983)
Весной 1980 года был открыт порт Мэйриэл Харбор, и тысячи кубинских беженцев ринулись в...
By Nikolai Pokryshkin 2023-01-22 12:18:07 0 19K
Volleyball
Serving in Volleyball
Where does volleyball start? With a good mood, with a good game, form or serve? Everyone chooses...
By FWhoop Xelqua 2023-03-13 18:56:51 0 12K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov