Created
January 18, 2019 19:27
-
-
Save parzibyte/bc0f6def165c5c8f349a5bff37545db8 to your computer and use it in GitHub Desktop.
Eliminar valor de diccionario en Python created by parzibyte - https://repl.it/@parzibyte/Eliminar-valor-de-diccionario-en-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
""" | |
Trabajando con diccionarios en Python: | |
eliminar clave de un diccionario | |
@author parzibyte | |
""" | |
mascota = { | |
"nombre": "Maggie", | |
"edad": 3, | |
"amigos": ["Capuchina", "Guayaba", "Cuco", "Balú", "Meca"] | |
} | |
print("Mascota es: ", mascota) | |
# Eliminar su nombre | |
del mascota["nombre"] | |
print("Luego de eliminar, es: ", mascota) | |
""" | |
Salida: | |
Mascota es: {'nombre': 'Maggie', 'edad': 3, 'amigos': ['Capuchina', 'Guayaba', 'Cuco', 'Balú', 'Meca']} | |
Luego de eliminar, es: {'edad': 3, 'amigos': ['Capuchina', 'Guayaba', 'Cuco', 'Balú', 'Meca']} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment