jknet 1 Report post Posted August 19, 2014 Boa noite gente, to querendo deletar o elemento usando a chave mas nao deu certo, progs = {"yes":["Close to the Edge","Fragile"],"Genesis":["Foxtrot","the Nursery Crime"],"Elp":["Brian Salad Surgery"]} print(len(progs)) 4 if(progs.has_key("Elp")): del (progs["Elp"]) print(len(progs)) 4 era pa sair 3, mas nao deletou, qual comando uso p resolver ? Share this post Link to post Share on other sites
_Isis_ 202 Report post Posted August 19, 2014 Aqui funciona na versão 2.7. >>> progs = {"yes":["Close to the Edge","Fragile"],"Genesis":["Foxtrot","the Nursery Crime"],"Elp":["Brian Salad Surgery"]} >>> print(len(progs)) 3 >>> if progs.has_key('Elp'): ... del(progs['Elp']) ... >>> print(len(progs)) 2 Share this post Link to post Share on other sites
jknet 1 Report post Posted August 19, 2014 Essa moderado é mto lindaaa, parabéns gata :D rsrsr Share this post Link to post Share on other sites