当我将一个文本文件复制到另一个文本文件时,新文件的末尾有两个字符:(??),这是我不想要的。我在 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
提交
取消