title: Writing sentences to a textfile from a list of words - python
body: <p>I have  a list of words that when combined form a sentence. I want to write this list into a text file, however, currently the list getting outputted vertically.</p>
  
  <p>For example:</p>
  
  <p>word_list = ["the", "winter", "is", "beautiful"]</p>
  
  <p>At the moment the output is...</p>
  
  <pre><code>the
  winter
  is
  beautiful
  </code></pre>
  
  <p>whereas I want it to be</p>
  
  <pre><code>the winter is beautiful.
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>def WriteToTextfile(list_to_write):
      new_writefile = open("text.txt","w")
      for k in list_to_write:
          new_writefile.write("%s\n" % k)
      new_writefile.close()
  </code></pre>