import string
def scaryDict(filename1, filename2):
s= filename1
Infile=open(filename1,'r')
OF = open(filename2, 'w')
for line in Infile:
Infile= s.lower()
Infile= s.replace('-',' ')
Infile= s.split()
Infile= s.sort()
scaryWords=[]
for word in filename1:
if len(word)>2:
scaryWords.append(word)
outfile.write(scaryWords)
Infile.close()
OF.close()
print(scaryWords)
scaryDict('frankenstein.txt', 'scarydict.txt')
当我运行程序时,我得到的消息是字符串没有atrribute类似于####