Remove Keys from Dictionary - Python
Posted 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.
Site içinde arama yapın
Kategoriler
- Arts
- Business
- Computers
- Oyunlar
- Health
- Home
- Kids and Teens
- Money
- News
- Personal Development
- Recreation
- Regional
- Reference
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Личное развитие
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Read More
How Much Should I Put in an Emergency Fund?
How Much Should I Put in an Emergency Fund?
Life is unpredictable. From sudden car repairs to...
How Do You Build a Strong Community?
Community building is both an art and a science. While the concept of bringing people together...
How Much Does It Cost to Hire a Business Consultant?
Hiring a business consultant can be a smart investment for any company looking to improve its...
Scarlet Macaw
Scarlet Macaw (Ara Macao) – With a spectacular plumage and an inquisitive nature these...
What is reproductive health?
What is reproductive health?
What is reproductive health?
Reproductive...