关于#爬虫#的问题:使用正则表达式爬取网站上的图片,但运行结果为none(语言-python)

使用正则表达式爬取网站上的图片,语法未报错,但运行结果为none

img

img

img

from lxml import etree
html=etree.HTML(resp.text)
imgs=html.xpath('//*[@class="pic"]/a/img/@src')
name=html.xpath('//*[@class="pic"]/a/img/@alt')
for n,i in enumerate(imgs):
    print(f"https://www.dpm.org.cn{i}")
    img=requests.get(f"https://www.dpm.org.cn{i}")
    with open(f'e:/{name[n]}.jpg', 'wb') as file:
        file.write(img.content)