'HREF WITH MONGODB QUERY
I done a query to my collection, then i removed all the characters that i don't need from my query, after that when i try to put my list (query result) in my HTML, i can't understand why it writes only the first number and not all the number. HTML :
<title>Lista Partite</title>
<h1>Lista Partite</h1>
{% for row in lista %}
<p>
<a href="{{url_for('Partita')}}">{{row[0]}}</a>
</p>
{% endfor %}
PYTHON FLASK
@app.route("/listapartite", methods=["POST", "GET"])
def ListaPartite():
data=db.get_collection("Partite")
lista = []
#filter = {'username': 1, 'user_posts': 1, '_id': 0}
# partite = db.data.find_one({'email' : email, 'password' : password}, {'_id': 1})
uno = data.find({},{'Sport': 1, 'Codice': 1, '_id': 0}) #stampare roba
# for row in uno:
# print(row)
# lista.append(row)
for row in uno:
numero=str(row)
numeromodificato = re.sub("[^0-9]", "",numero)
lista.append(numeromodificato)
print(lista)
RESULT enter image description here
But what i expect are those two numbers : ['1984', '1922']
Thank's for who ever can help me!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
