【发布时间】:2017-09-08 00:15:49
【问题描述】:
我有一些用于计算笛卡尔积的列表:
python.py:
@app.route('/output', methods = ['GET','POST'])
def output():
a = ['one','two']
b = ['three','four']
c = ['five']
d = ['six','seven','eight']
e = ['nine','ten','eleven']
cpl = list(itertools.product(a,b,c,d,e))
return render_template('output.html',cpl = cpl)
输出.html:
{% for cp in cpl %}
<p>{{ cp }} </p>
{% endfor %}
但是,我返回一个空白屏幕。
当我在 Jupyter 中运行相同的 python 代码时,我会返回列表。
我可能在哪里遇到问题?
【问题讨论】:
-
这可能只是您当前设置的问题。我在本地运行了你的代码,得到了预期的输出。
标签: python-3.x list loops flask jinja2