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
Autre
Pirates of the Caribbean: The Curse of the Black Pearl (2003)
Blacksmith Will Turner teams up with eccentric pirate "Captain" Jack Sparrow to save his love,...
Par Leonard Pokrovski 2023-06-23 19:53:50 0 33KB
Жизненные вопросы
Корпорация монстров. Monsters, Inc. (2001)
Склизкий гад в сливном бачке, мохнатый зверь, похожий на чудовище из «Аленького...
Par Nikolai Pokryshkin 2023-04-08 13:33:37 0 34KB
Products and Shopping
A Comprehensive Guide to Health Products: Enhancing Wellness Naturally
In today’s fast-paced world, where people are constantly juggling work, family, and social...
Par Dacey Rankins 2024-11-22 14:50:52 0 14KB
Business
How Long Does the Recruiting/Hiring Process Take?
The length of the recruiting and hiring process can vary widely depending on the role, industry,...
Par Dacey Rankins 2025-08-11 15:51:16 0 7KB
Media
World News Agencies
ABYZ News Links Directory links to more than 15,000 newspapers and other news sites such as news...
Par FWhoop Xelqua 2022-11-06 16:45:16 0 23KB

BigMoney.VIP Powered by Hosting Pokrov