Remove Keys from Dictionary - Python

0
12KB

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
Business
What are the Benefits of Being a Solopreneur?
The rise of the digital age has given birth to a new generation of business...
Par Dacey Rankins 2025-02-12 15:16:34 0 10KB
Dice
Dice
Dice are a popular source of randomness in board games (especially the game of the same name)....
Par Dacey Rankins 2024-04-03 16:00:58 0 14KB
Life Issues
The Sound of Music (1965)
A young novice is sent by her convent in 1930s Austria to become a governess to the seven...
Par Leonard Pokrovski 2023-06-27 18:25:07 0 28KB
Fitness
The Future of Fitness: Trends and Insights for 2024
Fitness is an ever-evolving industry, and 2024 is shaping up to be a year of innovation,...
Par Dacey Rankins 2024-11-06 18:04:50 0 12KB
Hockey
The Thrilling World of Hockey: A Sport of Skill, Strategy, and Speed
  The Thrilling World of Hockey: A Sport of Skill,...
Par Leonard Pokrovski 2024-06-27 17:38:16 0 18KB

BigMoney.VIP Powered by Hosting Pokrov