Remove Keys from Dictionary - Python

0
8K

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
Chemistry
Chemistry: The Science and Art of Matter
Chemistry plays a central role both due to its place among the natural and cognitive sciences,...
By FWhoop Xelqua 2023-03-21 16:32:17 0 20K
Социальные проблемы
Последний Парадизо. The Last Paradiso. (2021)
Италия, 1950-е.Свободолюбивый фермер борется за лучшие условия труда.Он мечтает о любви,...
By Nikolai Pokryshkin 2022-09-16 18:07:46 0 22K
Business
What Are the Best Ways to Finance a Startup?
Starting a business requires capital, and securing the right funding can determine the success or...
By Dacey Rankins 2025-03-13 16:37:31 0 8K
Financial Services
How well GDP measures the well-being of society
Key points GDP is an indicator of a society’s standard of living, but it is...
By Mark Lorenzo 2023-06-07 19:57:35 0 9K
Television
Emmanuel Live TV (English) Nigeria.
Emmanuel TV is a Christian TV Network. The channel is headquartered in Lagos, Nigeria and founded...
By Nikolai Pokryshkin 2022-08-30 21:21:23 0 31K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov