title: Python - Writing to a text file using functions?
body: <p>i wrote a simple function to write into a text file. like this,</p>
  
  <pre><code>def write_func(var):
          var = str(var)
          myfile.write(var)
  a= 5
  b= 5
  c= a + b
  write_func(c)
  </code></pre>
  
  <p>this will write the output to a desired file.
  now, i want the output in another format. say,</p>
  
  <pre><code>write_func("Output is :"+c)
  </code></pre>
  
  <p>so that the output will have a meaningful name in the file. how do i do it?
  and why is that i cant write an integer to a file? i do, <em>int = str(int)</em> before writing to a file?</p>