Python 网络爬取标题
发布网友
发布时间:2022-04-23 19:49
我来回答
共1个回答
热心网友
时间:2023-08-13 10:02
import beautifulsoup
import urllib2
def main():
userMainUrl = "你要抓取的地址"
req = urllib2.Request(userMainUrl)
resp = urllib2.urlopen(req)
respHtml = resp.read()
foundLabel = respHtml.findAll("label")
finalL =foundLabel.string
print "biaoti=",finalL
if __name__=="__main__":
main();