title: Python file modes detail
body: <p>In Python, the following statements do not work:</p>
  
  <pre><code>f = open("ftmp", "rw")
  print &gt;&gt; f, "python"
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  IOError: [Errno 9] Bad file descriptor
  </code></pre>
  
  <p>But with the following code it works:</p>
  
  <pre><code>g = open("ftmp", "r+")
  print &gt;&gt; g, "python"
  </code></pre>
  
  <p>It looks like I need to revise the file modes. What are the deep intricacies of the file opening modes?</p>