[Solved] How to find a word and only this word? [closed]


You can just use regex, example:

import re

# Example 1: word5
example_string = 'word5 word5555'
only_word5 = re.findall(r'word5\b', example_string)
print(only_word5)

2

solved How to find a word and only this word? [closed]