[英]SyntaxError: invalid syntax - Python/Django
我試圖簡單地在Django中顯示數據庫中的數據。 我收到以下錯誤; 語法錯誤
我在views.py中的代碼如下;
def InputDisplay(request):
input_info = Input.objects.all()
args = {"input_detail" : input_info}
print args
return render_to_response('Project/display.html', args,
context_instance=RequestContext(request))
我在display.html中的if語句;
{% block head %}
<title> Display Measurements</title>
{% endblock %}
{% block body %}
<div class="container">
<h1> Input Details </h1>
{% for detail in input_detail %}
{{ detail.id }}
{{ detail.waist }}
{{ detail.height }}
{% endfor %}
</div>
{% endblock %}
任何幫助是極大的贊賞。
更改
print args # python 2
至
print(args) # python 3
在python 3 print
語句中必須在()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.