How do I match a word in a text file using python?

前端 未结 5 1770
青春惊慌失措
青春惊慌失措 2021-01-13 03:58

I want to search and match a particular word in a text file.

with open(\'wordlist.txt\', \'r\') as searchfile:
        for line in searchfile:
            if         


        
5条回答
  •  梦毁少年i
    2021-01-13 04:48

    Look up the re module (regular expressions). re.search with the regex ' there ' is what you want.

提交回复
热议问题