title: How to use python io library to write on to an external file
body: <p>I am currently using the python io library to write in to an external file. Below is a sample piece of code which i am trying to execute:</p>
  
  <pre><code>import io
  output=io.StringIO
  output.write('\n Hello world ')
  output.close()
  print output.getvalue() 
  </code></pre>
  
  <p>when I run this piece of code i get an error. Can any one tell me where I am going wrong and whats the reason for the error. </p>