Remove Keys from Dictionary - Python

0
7K

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
Wholesale Trade
Understanding Wholesale Trade: Key Insights and Its Role in the Economy
Wholesale trade is a fundamental part of the global supply chain and plays a pivotal role in the...
By Dacey Rankins 2024-11-25 14:14:38 0 5K
Tools
Tools used to rennovate
If the Fixies really existed, they would be the most welcome guests in every home. However, they...
By FWhoop Xelqua 2023-05-14 21:08:16 0 18K
Social Issues
Babyteeth (2020)
When seriously ill teenager Milla falls madly in love with smalltime drug dealer Moses, it's her...
By Leonard Pokrovski 2022-10-24 19:23:33 0 20K
Animation
Lego Monkie Kid
LEGO Monkie Kid (Chinese: 悟空小侠) is a LEGO theme inspired by Monkey King and Journey to the West....
By FWhoop Xelqua 2023-05-17 17:01:02 0 18K
Телевидение
Прямой эфир ТНТ
ТНТ онлайн. Один из наиболее популярных телеканалов. Телеканал ТНТ известен такими проектами как...
By Nikolai Pokryshkin 2022-09-28 13:07:23 0 24K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov