1、
views文件
def testaa(request):
# aa=[]
for i in range(1,10):
aa='<a href="">test</a>'
aa='<a href="http://www.baidu.com">百度链接</a></br>'
# bb="<a href="http://www.sina.com.cn">bbbb</a>" return render(request,'testaa.html',locals())
2、html文件
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body> <li>{{ aa |safe }}</li>
{{ aa |safe }}
<a href="http://www.sina.com.cn">bbbb</a>
<script>
for (var i=0;i<5;i++){
{{ aa |safe }}
}
</script>
——————————————————————
{% for foo in aa %}
{{ aa |safe }}
{% endfor %}</body>
</html>
111
标签:aa,python,bbbb,safe,request,Django,html,testaa,view
From: https://blog.51cto.com/u_3369545/6591165