string-search

Search pattern to include square brackets

Search pattern to include square brackets Question: I am trying to search for exact words in a file. I read the file by lines and loop through the lines to find the exact words. As the in keyword is not suitable for finding exact words, I am using a regex pattern. def findWord(w): return re.compile(r’b({0})b’.format(w), …

Total answers: 4