我已經很多地跟隨了一個教程,並且我希望我的掃描器能夠清除包含每個警察局信息的特定頁面的所有鏈接,但它幾乎返回整個站點。Web掃描器將無法工作
from urllib import urlopen
import re
f = urlopen("http://www.emergencyassistanceuk.co.uk/list-of-uk-police-stations.html").read()
b = re.compile('<span class="listlink-police"><a href="(.*)">')
a = re.findall(b, f)
listiterator = []
listiterator[:] = range(0,16)
for i in listiterator:
print a
print "\n"
f.close()
請舉你跟着教程。 – Nix 2012-04-09 19:29:23
http://www.youtube.com/watch?v=Ap_DlSrT-iE我注意到他提到了beautifulsoup,但我知道我的腳本不使用它的任何功能 – 2012-04-09 19:31:14
emergencyassistanceuk.co.uk將不知道他們爲什麼現在有這麼多的交通...;) – Nix 2012-04-09 19:37:45