Remove Keys from Dictionary - Python
Posté 2023-02-23 23:16:41
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
- Arts
- Business
- Computers
- Jeux
- Health
- Domicile
- Kids and Teens
- Argent
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Lire la suite
Rabbit salad with ham, rice, corn and cucumber
Surprise guests with an unusual dish for the New Year. Salad "Rabbit" with corn, rice and ham, as...
Heat. (1995)
A group of high-end professional thieves start to feel the heat from the LAPD when they...
Discount trap: how not to fall for the marketing tricks of car dealerships
Today's auto market is full of enticing offers promising significant discounts and additional...
The King of Kong: A Fistful of Quarters (2007)
Die-hard gamers compete to break world records on classic arcade games.
My Link
What Are the Company's Core Values? Ensuring Candidates' Values Align with the Company's Culture
When candidates step into a job interview, they often focus on skills, experience, and...