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
Телевидение
Прямой Эфир телеканала Совета Федерации "ВМЕСТЕ-РФ"
Телеканалы, рассказывающие о работе парламентов, о том, как обсуждаются и принимаются законы, кто...
Par Nikolai Pokryshkin 2022-10-16 10:55:21 0 28KB
Programming
Reddit API Pricing
Reddit began shutting down some third-party apps after weeks of outrage over its API pricing...
Par Jesse Thomas 2023-07-10 23:45:44 0 13KB
Aviation
The fastest aircraft in the world and its competitors - How fast do they fly?
Modern aircraft are able to fly very fast. By "fast" I don't mean speeds 10 times faster than a...
Par FWhoop Xelqua 2022-10-25 11:02:46 0 24KB
Bodyart
Body Art
Body art is a form of avant-garde art that developed in the 1960s. The main object of body art is...
Par FWhoop Xelqua 2023-06-26 17:01:47 0 23KB
Vidéo
The Best Branded Videos of All Time, Helpful Tips for Inspiration
Creating effective branded videos is a long-term process that requires constant creativity and...
Par FWhoop Xelqua 2023-06-10 20:07:43 0 29KB

BigMoney.VIP Powered by Hosting Pokrov