Answer the question
In order to leave comments, you need to log in
What causes the program to crash when reading a text file?
When the file is read, a trace is output. Below is the error and the code that opens the file.
Error:
Code:
filenames = ['peter.txt', 'walkin_essays.txt']
for filename in filenames:
with open(filename) as file_object:
content = file_object.read()
print(content.count('the'))
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question