Updating value in binary file with Python
<p>I'm trying to figure out how to update the data in a binary file using Python.</p>

<p>I'm already comfortable reading and writing complete files using "array", but I'm having trouble with in place editing.</p>

<p>Here's what I've tried:</p>

<pre><code>my_file.seek(100)

my_array = array.array('B')
my_array.append(0)
my_array.tofile(my_file)
</code></pre>

<p>Essentially, I want to change the value of the byte at position 100. The above code does update the value, but then truncates the rest of the file. I want to be able to change the value at position 100, without modifying anything else in the file.</p>

<p>Note that I'm editing multi-gigabyte files, so I don't want to read the entire thing into memory, update memory, and then write back out to disk.</p>
