Remove Keys from Dictionary - Python
Postado 2023-02-23 23:16:41
0
12K
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
- Arts
- Business
- Computers
- Jogos
- Health
- Início
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
Вести Хакасия. ТВ прямой эфир.
В настоящее время филиал ВГТРК ГТРК «Хакасия» является структурным подразделением...
Tennis: The Timeless Sport of Skill, Strategy, and Endurance
Tennis: The Timeless Sport of Skill, Strategy, and Endurance
Tennis, a sport beloved for its...
What Are Common Barriers to Innovation, and How Can They Be Overcome?
Innovation is often hailed as the key to progress and growth in any organization or industry....
7 Common Conflict Styles That Show Up in Relationships, According to Experts
Conflict is a natural part of any relationship, whether romantic, familial, or professional....
25 OF THE MOST POPULAR SOUVENIRS
Returning from a trip and choosing souvenirs, people tend to buy something special and unique,...