find word in file python code example
Example 1: how to find word in file python
with open('example.txt') as f:
if 'blabla' in f.read():
print("true")
Example 2: python read text file look for string
f = open(filename, "r")
whattoReturn = "None"
if strToFind in f.read():
whattoReturn = strToFind