Remove Keys from Dictionary - Python

0
10كيلو بايت

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. 

البحث
الأقسام
إقرأ المزيد
Home Improvement
How to design a Room
Whether you don’t have the budget to hire an interior designer or simply enjoy the idea of...
بواسطة FWhoop Xelqua 2023-05-01 20:11:48 0 18كيلو بايت
Business
Brand positioning through texts and copywriting
Many outsiders and even business owners consider copywriting very narrowly - exclusively as the...
بواسطة Dacey Rankins 2024-09-03 18:36:47 0 12كيلو بايت
Искусство, культура и развлечения
Круэлла. Cruella. (2021)
Великобритания, 1960-е годы. Эстелла была необычным ребёнком, и особенно трудно ей было мириться...
بواسطة Nikolai Pokryshkin 2022-09-12 19:30:36 0 31كيلو بايت
Nature and Science
My Neighbor Totoro. (1988)
When two girls move to the country to be near their ailing mother, they have adventures with the...
بواسطة Leonard Pokrovski 2023-03-15 17:30:45 0 26كيلو بايت
Periods and Movements
Art periods
As long as we humans can use our hands, we create art. From the early cave paintings to the...
بواسطة FWhoop Xelqua 2023-07-11 18:46:08 0 22كيلو بايت

BigMoney.VIP Powered by Hosting Pokrov