title: How to write in new line in file in Python
body: <p>I have a file that is like this: </p>
  
  <pre><code>word, number
  word, number
  [...]
  </code></pre>
  
  <p>and I want to take/keep just the words, again one word in new line</p>
  
  <pre><code>word
  word
  [...]
  </code></pre>
  
  <p>My code so far</p>
  
  <pre><code>f = open("new_file.txt", "w")
  with open("initial_file.txt" , "r+") as l:
  for line in l:
      word = line.split(", ")[0]
      f.write(word)
      print word # debugging purposes
  </code></pre>
  
  <p>gives me all the words in one line in the new file</p>
  
  <pre><code>wordwordwordword[...]
  </code></pre>
  
  <p>Which is the pythonic and most optimized way to do this?
  I tried to use <code>f.write("\n".join(word))</code> but what I got was</p>
  
  <pre><code>wordw
  ordw
  [...]
  </code></pre>