0
我是比較新的Python的,我有問題是:刮HTML標題頭和匹配單詞表 - Python的3
我要指定一個網站,並有一個Python模塊颳去(如BeautifulSoup。)標題標題和打印「賓果」,如果它匹配單詞表中的任何單詞,否則打印「沒有什麼在這裏」
我的代碼如下,有關如何使這項工作的任何建議或想法?
import urllib.request
from bs4 import BeautifulSoup
Match = ("Whois", "domain", "IP", "search")
soup = BeautifulSoup(urllib.request.Request("https://whois.domaintools.com/"))
if (soup.title.string in Match):
print ("Bingo")
else:
print ("Nothing here!")
非常感謝你,UserAgent的障礙會讓我陷入困境。非常感激。 – veccct