Created
March 24, 2021 00:11
-
-
Save andeoliveira/ce4b965f385fc5ada55ab5e0050c3c40 to your computer and use it in GitHub Desktop.
Remove item do dicionário Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Remover um item do dicionário | |
bandas_dicionario = {"Rock Alternativo":"Red Hot Chili Peppers", "Indie Rock": "The Strokes", "Punk":"Ramones"} | |
#Método Remove | |
bandas_dicionario.pop("Heavy Metal", None) | |
print(bandas_dicionario) #{'Rock Alternativo': 'Red Hot Chili Peppers', 'Indie Rock': 'The Strokes', 'Punk': 'Ramones'} | |
#Instrução Del | |
del bandas_dicionario["Rock Alternativo"] | |
print(bandas_dicionario) #{'Indie Rock': 'The Strokes', 'Punk': 'Ramones'} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment