PyTesseract

for x in glob.glob(‘*.tiff’): data = pytesseract.image_to_string(Image.open(x)) f = os.path.splitext(x)[0] f = f + “.txt” with open(f, “w”) as file: file.write(data)

all_data = “” builder = [] for x in natsorted(glob.glob(‘*.txt’)): with open(x, “r”) as file: data = file.read() builder.append(data) builder.append(“\n\n\n\n”) all_data = ‘’.join(builder) with open(‘book.txt’, “w”) as fo: fo.write(all_data)