title: Why truncate when we open a file in 'w' mode in python
body: <p>I am going through Zed Shaw's Python Book. I am currently working on the opening and reading files chapters. I am wondering why we need to do a truncate, when we are already opening the file in a 'w' mode?</p>
  
  <pre><code>print "Opening the file..."
  target = open(filename, 'w')
  
  print "Truncating the file. Goodbye!"
  target.truncate()
  </code></pre>