It gets even simpler than that. You can use the "in" operator to test for the occurrence of a string within another string. For example, the following program will search for the string "quey" within every file inside all directories and subdirectories of "fdir".
import os
query = "localhost".lower()
fdir = 'aaron_storage'
for root, dirs, files in os.walk(fdir):
for file in files:
fname = os.path.join(root, file)
if query in open(fname, 'r').read().lower():
print '\n' + fname
print '.',
raw_input('Done')