擅长:python、mysql、java
^{bq}$
<p>如果以二进制模式打开这两个文件,则使用.read()读取,然后使用write()写入,则会得到完全相同的副本。如果使用其他机制,则可能会去掉行结尾或遇到问题,特别是在跨平台工作时。在</p>
<p>从文件中</p>
<blockquote>
<p>On Windows, 'b' appended to the mode opens the file in binary mode, so
there are also modes like 'rb', 'wb', and 'r+b'. Python on Windows
makes a distinction between text and binary files; the end-of-line
characters in text files are automatically altered slightly when data
is read or written. This behind-the-scenes modification to file data
is fine for ASCII text files, but it’ll corrupt binary data like that
in JPEG or EXE files. Be very careful to use binary mode when reading
and writing such files. On Unix, it doesn’t hurt to append a 'b' to
the mode, so you can use it platform-independently for all binary
files.</p>
</blockquote>
<p>在任何情况下,使用其他方法来进行文件复制,就像其他人建议的那样。在</p>