Python爬取内容为空


keyword="abc"
def ua(uapools):
    thisua=random.choice(uapools)

for i in range(0,2):
    url='https://s.taobao.com/search?q='+keyword+'&s='+str(i+1)
    res=requests.get(url,headers=ua(uapools))   #此处打印输出为正常
    pat='"pic_url":"(.*?)"'
    imglist=re.compile(pat).findall(res.text)
    print(len(imglist))

最后的len(imglist)打印输出为0,pat的表达式也是正确且唯一的,不知道什么原因

是不是你的请求那里并没有请求内容啊 你试试 res=requests.get(url,headers=ua(uapools)).content.decode("utf-8")看看