Remove Keys from Dictionary - Python
Postado 2023-02-23 23:16:41
0
7K
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
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Leia Mais
Телеканал Доктор Градус. Прямая трансляция.
Телеканал «Доктор Градус» целиком посвящен нетрадиционной медицине. При просмотре...
New Year's games
A home New Year's holiday is a long-standing good tradition. Older family members want to give...
Охотник на оленей. The Deer Hunter. (1978)
История о трех американцах русского происхождения - их жизни до, во время и после войны во...
Flower business at home
Flower business at home
Opening a flower business at home can be a great idea...
The Third Man. (1949)
Pulp novelist Holly Martins travels to shadowy, postwar Vienna, only to find himself...