I am working with tesseract library and want my text from an image to be in a single line, without new lines("\n"
).
I tried to use variable.replace("\n"," ")
, but it is not working. It just gives me the same multi line response.
Below is my code:
img = Image.open('maaan.jpg')
pytesseract.pytesseract.tesseract_cmd = 'C:\\Program Files (x86)\\Tesseract-OCR\\tesseract.exe'
kt = pytesseract.image_to_string(img,lang='eng')
kt.replace("\n", " ")
print(kt)
Thanks for the help btw :D