python 怎么把爬到的图片保存到本地?

python 怎么把爬到的图片保存到本地
import requests
# # import csv
from lxml import etree

path ='D:\Py\\images'
r_url = 'http://www.dili360.com/gallery'
res = requests.get(r_url)
r_header = {
    'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.55 Safari/537.36 Edg/96.0.1054.34'}


res_html = etree.HTML(res.text)
title = res_html.xpath("/html/body/div[1]/div[3]/ul/li/div[2]/h3/text()")
x_img = res_html.xpath("/html/body/div[1]/div[3]/ul/li/div[1]/a/img/@src")
href = res_html.xpath("/html/body/div[1]/div[3]/ul/li/div[1]/a/@href")


for item in title:
    print(item)
# for src_s in x_img:
#     print(src_s)
for img_url in href:
    img = requests.get('http://www.dili360.com'+img_url)
    img_html = etree.HTML(img.text)
    img_scrs = img_html.xpath("//html/body/div[2]/div[1]/img/@src")
    for src in img_scrs:
        filename = src.split('/')[-1]
        print(filename)
        with open(path+'/'+filename, 'wb')as f:
            f.write(src.content)
报错内容 AttributeError: 'lxml.etree._ElementUnicodeResult' object has no attribute 'content'
我想要达到的结果:把图片保存到本地

图片存储使用urllib模块,后面的代码修改为:

import urllib
for src in img_scrs:
    filename = src.split('/')[-1].split('@')[0]
    urllib.request.urlretrieve(url=src,filename=filename)