Remove Keys from Dictionary - Python
Posté 2023-02-23 23:16:41
0
11KB
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
How rising or falling interest rates might affect you
When the Federal Reserve raises or lowers its target interest rate, the change affects...
Rose Island. (2020)
An idealistic engineer builds his own island off the Italian coast and declares it a nation,...
How Do I Begin Creating Content on Platforms Like YouTube or Instagram?
Creating content on platforms like YouTube and Instagram has become a powerful way for...
The Joy of Boating: A Gateway to Adventure
Boating has long captivated enthusiasts, offering a unique blend of adventure, relaxation, and...
Digital marketing
Digital marketing is a way to promote goods and services over the Internet. To find new...