大批量抓取京东商品id和标签,废话不多说直接上代码
'''
在学习过程中有什么不懂得可以加我的
python学习交流扣扣qun,934109170
群里有不错的学习教程、开发工具与电子书籍。
与你分享python企业当下人才需求及怎么从零基础学习好python,和学习什么内容。
'''
import requests
import re
import pandas as pd
def get_data():
jj_url1 = 'http://search.jd.com/s_new.php?keyword=%E5%AE%B6%E5%B1%85%E7%94%A8%E5%93%81&enc=utf-8&qrst=1&rt=1&stop=1&pt=1&vt=2&sttr=1&offset=6&page='
jj_url2 = '&s=53&click=0'
bt_ = []
_id = []
url_list = []
for i in range(1, 10, 2):
jj_url = jj_url1 + str(i) + jj_url2
url_list.append(jj_url)
html = requests.get(jj_url).content.decode('utf-8')
reg1 = re.compile('<a target="_blank" title="(.*?)"')
reg2 = re.compile(