问题是: 我有我的@ app.route和相对def(),其中显示从“http://annotaria.web.cs.unibo.it/documents/”取自url的列表。 如何以html格式显示此网址?当我点击http://localhost:5000/articoli
我想显示我的网址列表。显示元素在与烧瓶和BeautifulSoup 3和Python的HTML 2.7.8
非常感谢您
@app.route('/articoli', methods=['GET'])
def lista_articoli():
lista = []
import urllib2
from bs4 import BeautifulSoup
url = urllib2.urlopen`http://annotaria.web.cs.unibo.it/documents/.read()`
soup = BeautifulSoup(url)
for row in soup.findAll('a'):
if row.parent.name == 'td':
if row["href"] :
myArticle = row["href"]
if '.html' in myArticle:
print myArticle
lista.append({'url':myArticle}) }
这很不清楚。为什么显示的网址列表与您在烧瓶中生成的任何其他文档不同? – 2014-08-28 17:33:43
是的,我希望通过瓶子生成的HTML文档与这些网址列表。 – 2014-08-28 19:58:11
而且,你的问题到底是什么?你知道如何用Flask正常创建页面吗? – 2014-08-28 20:31:58