How To Check If File Contains String With Python

Pavol Kutaj
Mar 14, 2022

--

The aim of this page📝 is for checking for a string in python which is a combination of the 3 built-in methods. I am using this when unit-testing the functionality of logging. This is the pattern:

open('<FILENAME>', 'r').read().find('<STRING>')

LINKS

--

--

No responses yet