According to Web site to download images and txt with the number that matches the picture stay

import re

encoding: utf-8

import requests,json,re
from urllib.request import urlretrieve
list=[]
#字典
r=requests.get(“http://10.:5555/invoke/Svc.websvc/get_SNInfo?startdt=2019-12-20”).json()
l=r[‘results’]

for i in r[‘results’]:
if i[‘rootcause’].find(‘多’)!=-1:
list.append(i[‘xray’])

print(list)
with open(‘D:\F\sn.txt’) as f:
linelist = []
hahalist = []

for line in f.readlines():
    line=line.strip('\n')
    linelist.append(line)
for i in list:

    a = re.findall(r"(.+)/", i)
    if len(a) > 0:
        b = re.sub(a[0], ' ', i)

        c = b.split('.')
        haha = ' '
        if '_' in c[0]:
            if len(c[0].split('_')[1]) == 12:
                haha = c[0].split('_')[1]

            if len(c[1]) == 12 and '_' not in c[1]:
                haha = c[1]
            if haha in linelist:
                hahalist.append(i)


print(hahalist)
for ii, i in enumerate(hahalist):
    outpath = 'D:/DO/osi/2019128/' + str(ii) + '.jpg'
    print(i)

    urlretrieve(i, outpath)
Published 41 original articles · won praise 7 · views 3676

Guess you like

Origin blog.csdn.net/weixin_43091087/article/details/103667393