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
Жизненные вопросы
Унесенные призраками. Spirited Away. (2001)
Тихиро с мамой и папой переезжает в новый дом. Заблудившись по дороге, они оказываются в странном...
Par Nikolai Pokryshkin 2022-11-24 20:18:50 0 26KB
Programming
Differences Between For Loop And forEach Loop in JavaScript
for loop forEach loop Generic type of loop and can be used in a variety of scenarios....
Par Jesse Thomas 2023-05-29 20:48:24 0 12KB
Hacking
Hacking as a business. Is it possible to make money from this?
Hello, dear friends. Hacking, the illegal use of computer technology to gain unauthorized access...
Par Michael Pokrovski 2024-03-25 20:41:23 0 25KB
Жизненные вопросы
Страсти Жанны д'Арк. The Passion of Joan of Arc. (1928)
1431 год. Жанна д`Арк предстает перед судом по обвинению в ереси.
Par Nikolai Pokryshkin 2023-04-13 17:12:39 0 27KB
Vidéo
The Evolution of Video Quality: From Grainy Footage to Ultra High Definition
Video quality has come a long way from its humble beginnings. From the flickering black-and-white...
Par Dacey Rankins 2024-11-11 16:22:45 0 10KB

BigMoney.VIP Powered by Hosting Pokrov