Remove Keys from Dictionary - Python
Posted 2023-02-23 23:16:41
0
11K
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.
Căutare
Categorii
- Arts
- Business
- Computers
- Jocuri
- Health
- Home
- Kids and Teens
- Money
- News
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Citeste mai mult
В джазе только девушки. Some Like It Hot. (1959)
Когда чикагские музыканты Джо и Джерри случайно становятся свидетелями бандитской перестрелки,...
The Importance of Construction and Maintenance in Modern Infrastructure
Construction and maintenance are two fundamental pillars that ensure the functionality, safety,...
FOX 5, Live TV New York USA
New York news, weather, traffic and sports from FOX 5 NY serving New York City, Long Island, New...
What Is Viral Growth?
In the digital age, many of the fastest-growing companies—Facebook, TikTok, Dropbox, and...
Mad Max: Fury Road. (2015)
In a post-apocalyptic wasteland, a woman rebels against a tyrannical ruler in search for her...