我用pythondjango编写了代码来解析url并将标记数据发送到另一个html页面,所以我已经编写了代码视图.py我需要使用块内容将数据发送到html页面。在
代码:
在视图.py在
from django.shortcuts import render_to_response
import urllib
import re
def home(request):
htmlf = urllib.urlopen("https://docs.djangoproject.com/en/dev/topics/http/urls")
htmlt = htmlf.read()
regex = '<title>(.+?)</title> '
patt = re.compile(regex)
price = re.findall(patt,htmlt)
return render_to_response("home.html", {'hello': price} )
在主页.html在
^{pr2}$这里的问题是我需要在主页.html第页。在
我想您使用的是django1.4+摆脱long
render_to_response
相关问题 更多 >
编程相关推荐