main
Bob Mottram 2024-07-23 13:09:20 +01:00
parent ceee615da2
commit 395fbf8189
1 changed files with 6 additions and 5 deletions

View File

@ -22,16 +22,17 @@ def _text_in_file2(text: str, filename: str,
"""
if not case_sensitive:
text = text.lower()
content = ''
try:
with open(filename, 'r', encoding='utf-8') as fp_file:
content = fp_file.read()
except OSError:
print('EX: unable to find text in missing file 2 ' + filename)
if content:
if not case_sensitive:
content = content.lower()
if text in content:
return True
except OSError:
print('EX: unable to find text in missing file 2 ' + filename)
return False