I'm trying to understand how flask works. i have this code with other stuff
@app.route("/")
def profile():
for i in range(28):
return render_template("profile.html",(data + str(i))=posts_to_chose[i])
i+=1
I want to rename data in data0, data1, data2.. So I can pass data to my html page:
<!DOCTYPE html>
<html lang="en">
<body>
<img src= {{data0}} title= "Title of image alt=" alt text here”>
<img src= {{data1}} title= "Title of image alt=" alt text here”>
<img src= {{data2}} title= "Title of image alt=" alt text here”>
...
<img src= {{data_n}} title= "Title of image alt=" alt text here”>
</body>
</html>
But I keep get this error:
return render_template("profile.html",(data + str(i))=posts_to_chose[i])
^
SyntaxError: keyword can't be an expression
I have 29 links and I know just this method to pass everything, if there is some other method please tell me Thankyou.