🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
```python """ @2021/3/29 """ import pytesseract from urllib import request from PIL import Image import time pytesseract.pytesseract.tesseract_cmd = r'D:\Tesseract-OCR\tesseract.exe' tessdata_dir_config = r'D:\Tesseract-OCR\tessdata' while True: # 每次刷新该URL回返回不同的验证码图片 url = "https://passport.lagou.com/vcode/create?from=register&refresh=1513081451891" # 捕获验证图片并存储为captcha.png图片 request.urlretrieve(url, 'captcha.png') image = Image.open('captcha.png') text = pytesseract.image_to_string(image, lang='eng', config=tessdata_dir_config) print(text) time.sleep(2) ```