In your code, you have to make a few changes
You have to replace re.match with re.search
The reason is, search() helps you to locate a match anywhere in a string
If you want the exact word 'Not Ok' then you can use \b word boundaries, else if you want a substring 'Not ok', then you can simply use,
if 'Not Ok' in string
>>> strs = 'Test result 1: Not Ok -31.08'
>>> re.search(r'\bNot Ok\b',strs).group(0)
'Not Ok'
>>> match = re.search(r'\bNot Ok\b',strs)
>>> if match:
... print "Found"
... else:
... print "Not Found"
...
Found
Want to be a Python expert? You can join this Python online course.
If you want to know more about this topic, you can also look at the following video tutorial :