2-14 使用pytesseract识别图片中得问题.py

示例图片:

2-14 使用pytesseract识别图片中得问题.py

首先创建read_image.py

import pytesseract
from PIL import Image
#生成图片的对象:
image = Image.open("C:/我的代码/selenium自动化测试/Selenium3 与 Python3 实战 Web自动化测试框架/imooc2.png")
#使用图片转换成文字:
text = pytesseract.image_to_string(image)
print(text)
结果:

2-14 使用pytesseract识别图片中得问题.py