【发布时间】:2019-09-15 18:22:01
【问题描述】:
有什么方法可以在浏览器中呈现抓取数据而不存储在数据库中。
用于抓取数据的代码。
search = query.lower()
p_search = "-".join(search.split())
url = "xyz"+p_search
myurl = Request(url, headers={'User-Agent': 'Mozilla/5.0'})
uReq = ureq(myurl)
uRead = uReq.read()
uReq.close()
soup = bs(uRead, 'lxml')
device_profile = soup.find('div', {'id': 'device-profile'})
return render(request, 'phone/device_profile.html', {'device': device_profile})
在浏览器中呈现数据的代码。
{% if device %}
{% for row in device %}
{{ row }}
{% endfor %}
{% endif %}
【问题讨论】:
-
那么你的代码有什么问题?
-
代码运行良好...我只想以 HTML 形式呈现数据...它在浏览器中的显示方式... [
关于 Oppo Find X
,
标签: python django beautifulsoup