代码运行出现溢出
content = re.findall(r'g_page_config = (.*?)g_srp_loadCss',html,re.S)[0]在这句话出现IndexError: list index out of range
我的代码
import requests
import re
url='https://s.taobao.com/search?imgfile=&js=1&stats_click=search_radio_all%3A1&ie=utf8'
header={
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36'
}
response=requests.get(url)
html=response.text
data=re.findall('g_page_config = (.*?)g_srp_loadCss', html, re.S)[0].strip()[:-1]
print(data)