file_name = 'Anna Karenina.txt'
with open(file_name,'r',encoding='utf-8') as file_book:
file_str = file_book.read()
print(file_str)
print('the ----------' +
file_str.lower().count('the') +
'times')
错误提示为:
Traceback (most recent call last):
File "count.py", line 9, in <module>
file_str.lower().count('the') +
TypeError: can only concatenate str (not "int") to str
这是错到哪儿了,我看了半天看不出来,谢谢!!!
with open(file_name,'r',encoding='utf-8') as file_book:
file_str = file_book.read()
print(file_str)
print('the ----------' +
file_str.lower().count('the') +
'times')
错误提示为:
Traceback (most recent call last):
File "count.py", line 9, in <module>
file_str.lower().count('the') +
TypeError: can only concatenate str (not "int") to str
这是错到哪儿了,我看了半天看不出来,谢谢!!!
