Remove Keys from Dictionary - Python

0
6K

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. 

Pesquisar
Categorias
Leia Mais
Телевидение
PUBLIKA Live TV. Телевидение на русском, молдавском и румынском.
Телевидение Молдавии на русском и молдавском языках. Новости, погода, политика, происшествия и...
Por Nikolai Pokryshkin 2022-10-31 14:28:01 0 21K
Programming
Python lavalink.py
Lavalink.py is a wrapper for Lavalink which abstracts away most of the code necessary to use...
Por Jesse Thomas 2023-04-19 20:17:31 0 6K
Business
Marketing metrics: what metrics are important to track
Marketing metrics: what metrics are important to track In this article, we will talk...
Por Leonard Pokrovski 2024-08-22 17:38:22 0 13K
Жизненные вопросы
Седьмая Печать. The Seventh Seal. (1957)
В середине XIV века рыцарь Антониус Блок и его оруженосец возвращаются после десяти лет крестовых...
Por Nikolai Pokryshkin 2023-04-07 13:20:35 0 21K
Data Communications
7 Easy Ways to Transfer Files from Android to PC
Sometimes we need to transfer something from a smartphone to a computer. These can be both text...
Por FWhoop Xelqua 2023-01-13 18:05:31 0 18K
image/svg+xml


BigMoney.VIP Powered by Hosting Pokrov