爬取50个验证码demo


import requests# http客户端

import os# 创建文件夹

from PILimport Image

os.makedirs('./image/', exist_ok=True)

IMAGE_URL ="http://jwgl.cqjtu.edu.cn/jsxsd/verifycode.servlet?t=0.33489178693749055"

path ="D:\\11\\yanzheng\\a\\"

def request_download():

r = requests.get(IMAGE_URL)

with open('./image/img.png','wb')as f:

f.write(r.content)

if __name__ =='__main__':

for iin range(50):

path1=""+str(i)+".jpg"

        print(path1) 

request_download()

im = Image.open('./image/img.png')

path=path+path1

im.save(path)

path="D:\\11\\yanzheng\\a\\"

你可能感兴趣的:(爬取50个验证码demo)