Remove Keys from Dictionary - Python

0
11K

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
Television
FOX Weather Live TV USA
Streaming 24/7 from America's Weather Center.Fox Weather is a digital broadcast television...
By Nikolai Pokryshkin 2022-09-05 08:52:17 0 33K
Social Issues
The Wolf of Wall Street. (2013)
Based on the true story of Jordan Belfort, from his rise to a wealthy stock-broker living the...
By Leonard Pokrovski 2023-02-09 14:36:26 0 20K
Home
How to Make Your Home Cozier, Designer's Tips
How to Make Your Home Cozier, Designer's Tips Cozy home design is an interior decoration...
By Leonard Pokrovski 2024-04-24 16:07:48 0 17K
Kites
Soaring Through Time: The Art of Recreating Kites
Soaring Through Time: The Art of Recreating Kites From the serene flight of a bird-shaped kite...
By Leonard Pokrovski 2024-05-11 18:10:30 0 15K
Support Groups
How do I organize a support group?
In this article, we will talk mainly about the so-called peer support groups, in which...
By FWhoop Xelqua 2023-02-06 15:57:58 0 21K

BigMoney.VIP Powered by Hosting Pokrov