def code_api(): # 请求验证码 ocr = ddddocr.DdddOcr() with open('code.jpg', 'rb') as f: img_bytes = f.read() result = ocr.classification(img_bytes) print('识别出的验证码为:' + result) return result