0

I am using paddleocr. I want to find a word/words in the OCR Result. For example the ocr output is "ilovepythonalot" And I want to find the word "love" using

if Chose1 in ocrresult: #Chose1='love'
    print('true')
else:
    print('false')

the result is only giving out "false" Is there any way that i can fix it?

LorisKamp
  • 1
  • 2
  • You don't really need the `if` statement, instead `print(Chose1 in ocrresult)` unless you specifically need the strings 'true' or 'false' printed as opposed to booleans. – bn_ln Sep 19 '22 at 07:18

1 Answers1

0

Looking at the documentation, paddleocr likely outputs a list of strings, so you might want to merge them into one text first:

if Chose1 in ' '.join(ocrresult): #Chose1='love'
    print('true')
else:
    print('false')
RJ Adriaansen
  • 9,131
  • 2
  • 12
  • 26