이것은 내 코드 스 니펫입니다. render_to_response가 제대로 작동하지 않는 이유
soup=BeautifulSoup(html_document)
tabulka=soup.find("table",width="100%")
dls=tabulka.findAll("dl",{"class":"resultClassify"})
tps=tabulka.findAll("div",{"class":"pageT clearfix"})
return render_to_response('result.html',{'search_key':search_key,'turnpages
':tps,'bookmarks':dls})
나는 그것은 딕셔너리가
<dl>label contents contains some <dd> labels</dl>
그러나 패스 DLS는 결과에는 render_to_response하는 후
가 올바르지 않은 하나 개의 HTML 레이블이 포함되면, DLS를 확인했습니다. result.html에서 대응하는 템플릿 코드 :{% if bookmarks %}
{% for bookmark in bookmarks %}
{{bookmark|safe}}
{% endfor %}
{% else %}
<p>No bookmarks found.</p>
{% endif %}
출력 결과 HTML 이런 파이썬 사전 포맷을 포함
[<dd>some html</dd>,<dd>some html</dd>,<dd>some html</dd>,...]
이 출력 HTML에서 나타난다. 그것은 매우 이상합니다. 이것은 renfer_to_response의 버그입니까?
보안 측면을 언급하기 위해 +1 – heinrich5991