Python 3.x 如何告诉pytesseract有一定数量的数字

Python 3.x 如何告诉pytesseract有一定数量的数字,python-3.x,python-tesseract,Python 3.x,Python Tesseract,我正在尝试解决一些验证码图像。 我知道图像中总是有6位数字。 在python中,我使用这个配置 pytesseract.image_to_string(cropped_img, lang='eng', config="--psm 8 --oem 3 digits") 它非常成功,但有时它会显示图片中的1到7个数字。有没有一种方法,我可以设置配置,让它总是显示6个数字

我正在尝试解决一些验证码图像。 我知道图像中总是有6位数字。 在python中,我使用这个配置

pytesseract.image_to_string(cropped_img, lang='eng', config="--psm 8 --oem 3 digits")
它非常成功,但有时它会显示图片中的1到7个数字。有没有一种方法,我可以设置配置,让它总是显示6个数字