def fileCounter():
infile = open('words.txt','r') # Open the source file
outfile = open('File_Results.txt','w')
data = infile.read()
lineCount = len(data.split('\n'))
wordCount = len(data.split())
charCount = len(data)
results = print(lineCount,wordCount,charCount)
infile.close()
outfile.write()
outfile.close()
fileCounter()
我是新来编码,这是我第一次使用文件。我如何在我的外场写结果?我不断收到此错误 - TypeError:write()参数必须是str,而不是无Python写数据输出文件
没有任何这些反应的回答你的问题?如果是这样,您应该使用旁边的复选框标记最佳答案。 –