Python 爬虫之旅用PQ获取数据
发布时间
阅读量:
阅读量
当我们在互联网上成功访问并获取到某网站的HTML页面内容时
第一步:用正则表达式定位
在网页源代码中进行检查,在获取包含所需数据信息的列表中查找具有单一性特征的部分,并将其识别为匹配的目标模式
strpattern = r'(?<=<table width="100%" border="0" cellpadding="0" cellspacing="0" class="searchdiv">).+?(?=</table>)'
pt = re.compile(strpattern, re.S)
mch1 = re.search(pt, strhtml)
全部评论 (0)
还没有任何评论哟~
