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

前端 未结 5 1764
青春惊慌失措
青春惊慌失措 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条回答
  •  独厮守ぢ
    2021-01-13 04:32

    You ought to use a regular expression. The regular expression howto from the Python docs might be a good place to start.

提交回复
热议问题