If you just need to check if the two strings are exactly same,
text1 = 'apple'
text2 = 'apple'
text1 == text2
The result will be
True
If you need the matching percentage,
import difflib
text1 = 'Since 1958.'
text2 = 'Since 1958'
output = str(int(difflib.SequenceMatcher(None, text1, text2).ratio()*100))
Matching percentage output will be,
'95'