Remove Keys from Dictionary - Python

0
8KB

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. 

Rechercher
Catégories
Lire la suite
Occupational Health and Safety
Occupational Health and Safety
Labor protection and safety at the enterprise include a set of measures aimed at ensuring the...
Par FWhoop Xelqua 2023-02-10 18:11:24 0 14KB
Financial Services
Aggregate demand and aggregate supply curves
Key points Aggregate supply is the total quantity of output firms will...
Par Mark Lorenzo 2023-03-23 20:00:34 0 13KB
Business
What is Business Ethics?
Business ethics is a field of study that deals with the principles, standards, and moral...
Par Dacey Rankins 2025-01-30 15:58:17 0 7KB
Laser Games
The Thrilling World of Laser Games: Where Strategy Meets Adventure
The Thrilling World of Laser Games: Where Strategy Meets Adventure In the realm of interactive...
Par Leonard Pokrovski 2024-06-30 14:06:10 0 17KB
Financial Services
The benefits and costs of US environmental laws
Key points Taken as a whole, the benefits of US environmental regulation have...
Par Mark Lorenzo 2023-02-20 17:47:53 0 9KB
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov