def get_img(url, fn):
resp = requests.get(url)
with open('{}.png'.format(fn), 'wb') as f:
f.write(resp.content)
#get_img('https://laoshiimg.xdf.cn/./2019-08-15/01747c7d5715e.jpg', '王志敏')
for zl in soup.select('dl[class="clearfix"]'):
for h3 in zl.select('h3'):
name = h3.text
for a in zl.select('p[class="ppl1 clearfix"]'):
jybj = a.text
for b in zl.select('p[class="ppl2 clearfix"]'):
kc = b.text
for img in zl.select('dt'):
img_address = img.img.get('src')
if '英语' in kc:
get_img(img_address, name)