pythonstringintegerpython-tesseract

Python | My code recognizes the number 100 on the screen via pytesseract as str, but I need to get an int


There is a number in a certain area For example - 100 It is recognized through pytesseract (pytesseract.image_to_string) as str, but I need an int to pass the result to the calculation formula, because str does not accept How can this problem be solved?

I tried to find a solution a long time ago, I don’t remember how I changed the code and what results I got, but I still haven’t found a solution


Solution

  • Let s be the image_to_string result.

    Then the integer you want is: int(s)