Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -48,6 +48,11 @@ def filter_book(libro, campo, valor, operador='==') -> List:
|
|
| 48 |
"""
|
| 49 |
Filtra libros según un campo, valor y operador especificados
|
| 50 |
operadores permitidos: ==, >, <, >=, <=, contains
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
"""
|
| 52 |
if operador == 'contains':
|
| 53 |
return [libro for libro in libros if valor.lower() in str(getattr(libro, campo)).lower()]
|
|
|
|
| 48 |
"""
|
| 49 |
Filtra libros según un campo, valor y operador especificados
|
| 50 |
operadores permitidos: ==, >, <, >=, <=, contains
|
| 51 |
+
Args:
|
| 52 |
+
libro: name o text title of the book we are looking for
|
| 53 |
+
campo: field of the book we are looking for
|
| 54 |
+
valor: value to compair with the field
|
| 55 |
+
operador: kind of compartive that we want to have over the field and de value
|
| 56 |
"""
|
| 57 |
if operador == 'contains':
|
| 58 |
return [libro for libro in libros if valor.lower() in str(getattr(libro, campo)).lower()]
|