-
-
Save parzibyte/d5ccef5029f037737c4a28201f1c96ad 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
def obtener_palabras(): | |
return Palabra.select() | |
def buscar_significado_palabra(palabra): | |
# peewee va a lanzar una excepción si no encuentra filas que coincidan | |
try: | |
return Palabra.select().where(Palabra.palabra == palabra).get().significado | |
except Exception: | |
# Y nosotros atrapamos esa excepción devolviendo None, lo que significa que no existe la palabra | |
return None |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment