<p>我有以下代码:</p>
<pre><code>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")
</code></pre>
<p>总是会出现这个错误:</p>
<pre><code>line 80, in search
if string in content:
TypeError: argument of type 'builtin_function_or_method' is not iterable
</code></pre>
<p>有人能解释一下原因吗。</p>
<p>坦斯</p>