Posts by Diogo Neto • 11 points
4 posts
-
0
votes1
answer50
viewsA: Correct way to execute query in Django?
In the official documentation of Django there are tutorials explaining how it is done and there are other websites with tutorials that Voce can learn. Tutoral Django Other tutorials…
-
0
votes3
answers14487
viewsA: Divide a list into n sublists
Here: aLista = [1, 2, 3 , 4, 5, 6, 7, 8, 9] aLista = iter(aLista) result = [] for i in aLista: try: result.append([i, next(aLista)]) except Exception: result.append([i]) print(result)…
-
0
votes1
answer37
viewsA: Mongodb does not return query correctly
Instead of using except: print('Nenhum planeta foi encontrado.') uses except ValueError: print('Nenhum planeta foi encontrado.')
-
1
votes2
answers242
viewsA: Picking up request attribute with Python Json gives error
You can handle the "Keyerror" error and launch an exception with a 404. Here’s something like this: try: cpf = request.json['cpf'] except KeyError: return render_template('404.html'), 404…