我想知道烧瓶是怎么工作的。 我有这个代码和其他东西
@app.route("/")
def profile():
for i in range(28):
return render_template("profile.html",(data + str(i))=posts_to_chose[i])
i+=1
我要重命名数据0、数据1、数据2中的数据。。 因此我可以将数据传递到我的html页面:
<!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>
但我一直有个错误:
return render_template("profile.html",(data + str(i))=posts_to_chose[i])
^
SyntaxError: keyword can't be an expression
我有29个链接,我只知道这个方法通过一切,如果有其他方法请告诉我 谢谢你。你知道吗
你试过让它返回一个列表而不是一个表达式吗?像这样:
相关问题 更多 >
编程相关推荐