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
- Recreation
- Reference
- Regional
- Science
- Shopping
- Society
- Sports
- Бизнес
- Деньги
- Дом
- Досуг
- Здоровье
- Игры
- Искусство
- Источники информации
- Компьютеры
- Наука
- Новости и СМИ
- Общество
- Покупки
- Спорт
- Страны и регионы
- World
Lire la suite
Третий человек. The Third Man. (1949)
Холли Мартинс, автор бульварных романов, в надежде получить работу приезжает в послевоенную Вену...
How Do I Write a Check?
How Do I Write a Check?
Writing a check may seem like an old-fashioned task in the digital age...
ADHD: Controversy
ADHD, its diagnosis, and its treatment have been controversial since the 1970s. The controversies...
Citizenfour (2014)
A documentarian and a reporter travel to Hong Kong for the first of many meetings with Edward...
Can I Use Credit or Debit Cards Abroad? Understanding Fees, Tips, and Best Practices
Can I Use Credit or Debit Cards Abroad? Understanding Fees, Tips, and Best Practices
Traveling...