Created
December 20, 2018 19:25
-
-
Save parzibyte/b14b71539ec6f732d7844032a3a9988d to your computer and use it in GitHub Desktop.
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
""" | |
Explicar **kwargs en Python con una | |
función | |
@author parzibyte | |
""" | |
def conectar(**opciones): | |
host = opciones.get("host", "localhost") | |
puerto = opciones.get("puerto", "27017") | |
usuario = opciones.get("usuario", | |
"root?") # Aunque root no existe en MongoDB, creo | |
palabra_secreta = opciones.get("palabra_secreta", "123") | |
nombre_base_de_datos = opciones.get("nombre_base_de_datos", "test") | |
print( | |
"Host: {}, puerto: {}, usuario: {}, palabra_secreta: {}, nombre_base_de_datos: {}" | |
.format(host, puerto, usuario, palabra_secreta, nombre_base_de_datos)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment