Remove Keys from Dictionary - Python

0
9Кб

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. 

Поиск
Категории
Больше
Life Issues
Colombiana. (2011)
A young girl in Bogotá witnesses her parents' murder and grows up to be a stone-cold...
От Leonard Pokrovski 2023-05-22 20:12:57 0 30Кб
Real Estate
Real Estate: A Comprehensive Overview
Real estate is a dynamic sector that plays a crucial role in the economy, providing not only...
От Dacey Rankins 2024-10-21 16:56:39 0 10Кб
Social Issues
Inside Job. (2010)
'Inside Job' provides a comprehensive analysis of the global financial crisis of 2008, which at a...
От Leonard Pokrovski 2023-06-03 18:38:51 0 26Кб
Социальные проблемы
История Игрушек. Большой побег. Toy Story 3. (2010)
Энди почти 18 лет, ему остаётся 3 дня до отправки в колледж, в то время как его игрушки, в том...
От Nikolai Pokryshkin 2023-01-08 18:24:06 0 24Кб
Истории
In Secret. (2013)
Thérèse grows up with her aunt and cousin. Around 1860 the aunt decides they move...
От Leonard Pokrovski 2023-04-28 19:36:18 0 24Кб

BigMoney.VIP Powered by Hosting Pokrov