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寫數據輸出文件
沒有任何這些反應的回答你的問題?如果是這樣,您應該使用旁邊的複選框標記最佳答案。 –