Remove Keys from Dictionary - Python

0
11KB

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
Personal Finance
Moody's downgrades Israel's credit rating
The international rating agency Moody's has downgraded Israel's credit rating by two notches at...
Par Dacey Rankins 2024-10-23 16:20:52 0 21KB
Environment
The State of the Environment: Challenges and Solutions for a Sustainable Future
The environment, our natural world, is the foundation of life on Earth. It provides the air we...
Par Dacey Rankins 2024-11-08 16:30:30 0 13KB
Телевидение
Известия 78. ТВ он лайн.
Телевидение Петербурга. Новостные программы, благодаря которым вы оперативно получаете информацию...
Par Nikolai Pokryshkin 2022-10-19 20:49:02 0 27KB
Mental Health
ADHD: Exercise
Regular physical exercise, particularly aerobic exercise, is an effective add-on treatment for...
Par Kelsey Rodriguez 2023-05-03 17:41:29 0 11KB
Marketing and Advertising
How Do I Drive Traffic to My Affiliate Links?
Affiliate marketing can be lucrative, but there’s a catch: without traffic, you can’t...
Par Dacey Rankins 2025-09-18 17:50:35 0 5KB

BigMoney.VIP Powered by Hosting Pokrov