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
Жизненные вопросы
Развод Надера и Симин. A Separation. (2011)
Супруги Надер и Симин решили уехать из Ирана в поисках лучшей жизни. Но в один момент Надер...
Par Nikolai Pokryshkin 2023-01-27 17:42:01 0 28KB
Business
Who Are the Most Successful Startup Founders?
In the world of innovation and entrepreneurship, certain names stand out as pioneers who have...
Par Dacey Rankins 2025-04-14 13:26:49 0 9KB
Television
8XM Live TV. Pakistan.
8XM is a Pakistani music television channel, on air since July 2011. 8XM airs all types of music,...
Par Nikolai Pokryshkin 2022-11-26 19:01:37 0 43KB
Business
What is Feedback, and Why Is It Important?
Understand the definition of feedback and its significance in personal development, business...
Par Dacey Rankins 2025-05-27 14:24:57 0 6KB
Social Issues
Fargo. (1996)
Minnesota car salesman Jerry Lundegaard's inept crime falls apart due to his and his henchmen's...
Par Leonard Pokrovski 2023-03-13 20:28:59 0 26KB

BigMoney.VIP Powered by Hosting Pokrov