擅长:python、mysql、java
<p>使用<code>seek</code>函数将文件分块获取,并在每次将其附加到输出文件中</p>
<pre><code>CHUNK_SIZE = 1000 #for example
with open(source_file, 'rb') as source:
with open(target_file, 'a') as target:
bytes = bytearray(source.read(CHUNK_SIZE))
source.seek(CHUNK_SIZE)
for i in range(len(bytes)):
bytes[i] ^= 0x71
target.write(bytes)
</code></pre>