我有以下代码:
def search():
os.chdir("C:/Users/Luke/Desktop/MyFiles")
files = os.listdir(".")
os.mkdir("C:/Users/Luke/Desktop/FilesWithString")
string = input("Please enter the website your are looking for (in lower case):")
for x in files:
inputFile = open(x, "r")
try:
content = inputFile.read().lower
except UnicodeDecodeError:
continue
inputFile.close()
if string in content:
shutil.copy(x, "C:/Users/Luke/Desktop/FilesWithString")
总是给出这个错误:
line 80, in search
if string in content:
TypeError: argument of type 'builtin_function_or_method' is not iterable
有人可以解释为什么。
比