Mam następujący kod:Python: Błąd typu: argument typu 'builtin_function_or_method' nie jest iterable
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")
który zawsze daje ten błąd:
line 80, in search
if string in content:
TypeError: argument of type 'builtin_function_or_method' is not iterable
ktoś może rzucić nieco światła na dlaczego.
Thans
got it, thanks a lot –
@ LWH91: Nie zapomnij, aby zaakceptować i upvote odpowiedź, że pomogło. – Abhijit