Editing file header info in Python
<p>I'm pretty new to python, and I'm trying to edit data in a .mobi file from a Python script. I am able to read all the meta data, but I can't figure out how to save the info I need back into the correct place. Every time I try, it just corrupts the file.</p>

<p>This is a snippet of what I'm having problems with:</p>

<pre><code>    metadata['ASIN'] = "B00012345"
    data += "Modified ASIN: " + metadata['ASIN']

    g = file(infile)
    header2 = g.read(312)

    f = open(infile, 'wb')
    f.seek(header2[0xA4E])
    f.write(metadata['ASIN'])
    f.close()
</code></pre>

<p>Can someone tell me what I'm doing wrong?</p>

<p>Thanks</p>
