問題是: 我有我的@ 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