Как удалить элемент из словаря в python по ключу?



Вы можете использовать del <Список>["<Ключ>"]



costs = {

"The Mist" : 13,

"Mile 81" : 12,

"11/22/63" : 17,

"The Green Mile" : 14,

"Fairy Tale" : 10,

"End of Watch" : 18

}



del costs["Mile 81"]



print(costs)




# Вывод : {'The Mist': 13, '11/22/63': 17, 'The Green Mile': 14, 'Fairy Tale': 10, 'End of Watch': 18}



Подписывайтесь на канал 👉@pythonofff