title: Open file for reading and writing with truncate
body: <p>How do I open a file for reading and writing that is also truncated to 0?</p>
  
  <p>I've tried:</p>
  
  <pre><code>f = open(PATH, 'w+')
  </code></pre>
  
  <p>I'm unable to read from the file (<code>f.read()</code> returns an empty string), however.</p>
  
  <p>Also:</p>
  
  <pre><code>f = os.fdopen(os.open(PATH, os.O_RDWR | os.O_TRUNC), 'r+')
  </code></pre>
  
  <p>Same behavious as the previous code.</p>