- 链接地址:https://download.csdn.net/download/weixin_38711008/13752635
- 链接标题:Python爬虫第一课,选取标签内容_网站爬虫返回空资源-CSDN文库
- 所属网站:download.csdn.net
- 被收藏次数:9335
资源浏览查阅175次。Python爬虫第一课,选取标签内容,Python爬虫第一课,选取标签内容获取标题`#fromurllib.requestimporturlopen`#fromurllib.errorimportHTTPErrorfrombs4importBeautifulSoupdefgetTitle(url):try:html=urlopen(url)exceptHTTPErrorase:returnNonetry:bsObj=BeautifulSoup(html.read())title=bsObj.body.h1exceptAttributeErrorase:更多下载资源、学习资料请访问CSDN文库频道
版权声明:本文发布于特牛网址导航 内容均来源于互联网 如有侵权联系删除