我玩弄了robotparses庫,而我從嘗試的例子程序:Python的robotparser不返回true或false
http://docs.python.org/library/robotparser.html
我的代碼是currently-
import robotparser
def TestMain():
#Check robots.txt
rp = robotparser.RobotFileParser()
rp.set_url("http://www.musi-cal.com/robots.txt")
rp.read()
rp.can_fetch("*", "http://www.musi-cal.com/cgi-bin/search?city=San+Francisco")
我遇到的問題是,當我運行代碼它運行成功,但不返回任何東西,任何人有任何想法爲什麼?
感謝
你的函數沒有return語句,你怎麼調用它? – root