當我將一個文本文件復制到另一個文本文件時,新文件的末尾有兩個字符:(??),這是我不想要的。我在 Windows7 上使用 Python3.6.0這是我的腳本:from sys import argvscript, from_file, to_file = argv#Open from_file and get the text from itindata = open(from_file).read()#Write the from_file text to to_fileopen(to_file, 'w').write(indata)我在 PowerShell 中運行以下命令:>echo "This is a test file." > TestSource.txt>type TestSource.txtThis is a test file.>python CopyFile.py TestSource.txt TestDestination.txt>type TestDestination.txtThis is a test file.??為什么我創建的文件中會出現兩個問號 (??)?編輯:此相關問題被建議為重復。我的問題是當我將一個文本文件復制到另一個文本文件時 Python 的行為。這個相關問題是關于 Windows PowerShell 如何創建文本文件的。
添加回答
舉報
0/150
提交
取消