from pytesseract import Output pytesseract.image_to_data( img, output_type=Output.STRING ) #returns string pytesseract.image_to_data( img, output_type=Output.DICT ) #returns a dict