pytesseract.image_to_string file format code example
Example: pytesseract.image_to_string save text file
try:
from PIL import Image
except ImportError:
import Image
import pytesseract
# Simple image to string
text=print(pytesseract.image_to_string(Image.open('test.jpg'),lang="eng"))
with open('out.txt', 'w') as f:
print(text, file=f)