这是一个用 Python 编写的 ScraperWiki 刮板:
import lxml.html
import scraperwiki
from unidecode import unidecode
html = scraperwiki.scrape("http://www.timeshighereducation.co.uk/world-university-rankings/2012-13/world-ranking/range/001-200")
root = lxml.html.fromstring(html)
for tr in root.cssselect("table.ranking tr"):
if len(tr.cssselect("td.rank")) > 0 and len(tr.cssselect("td.uni")) > 0:
university = unidecode(tr.cssselect("td.uni")[0].text_content()).strip().title()
if 'cole' in university:
print university
它产生以下输出:
Ecole Polytechnique Federale De Lausanne
Ecole Normale Superieure
Acole Polytechnique
Ecole Normale Superieure De Lyon
我的问题:是什么导致第三个输出行上的初始字符呈现为“A”而不是“E”,我怎样才能阻止这种情况发生?