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
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Lire la suite
The Treasure of the Sierra Madre. (1948)
Two down-on-their-luck Americans searching for work in 1920s Mexico convince an old prospector to...
What Is the Vision for the Company’s Future?
A clear and compelling vision is the cornerstone of any successful enterprise....
What Are the Core Components of a Marketing Strategy?
Introduction
A strong marketing strategy is the backbone of successful business growth. It...
How Do I Balance Work and Life as a Founder?
As a startup founder, achieving a healthy work-life balance can seem like an impossible task. The...
Lacrosse | What is Lacrosse?
Lacrosse (French pronunciation: [lacrosse]; la crosse ("stick") is a team game in which two teams...