爱采购标题爬虫
作者:互联网
import requests import re # https://b2b.baidu.com/s?q= key='建筑机械' url='https://b2b.baidu.com/s?q='+key data=requests.get(url).text tit ='"fullName":"(.*?)"' alltit = re.compile(tit,re.S).findall(data) for item in alltit: print(eval('u"'+str(item)+'"')) #eval 将字符串str当成有效的表达式子来求值并返回计算结果 print('--------------')
标签:https,tit,爬虫,标题,re,key,print,import,采购 来源: https://www.cnblogs.com/adam012019/p/12359106.html