title: Problems with Python's file.write() method and string handling
body: <p>The problem I am having at this point in time (being new to Python) is writing strings to a text file. The issue I'm experiencing is one where either the strings don't have linebreaks inbetween them or there is a linebreak after <strong>every</strong> character. Code to follow:</p>
  
  <pre><code>import string, io
  
  FileName = input("Arb file name (.txt): ")
  
  MyFile = open(FileName, 'r')
  
  TempFile = open('TempFile.txt', 'w', encoding='UTF-8')
  
  for m_line in MyFile:
      m_line = m_line.strip()
      m_line = m_line.split(": ", 1)
      if len(m_line) &gt; 1:
          del m_line[0]
      #print(m_line)
      MyString = str(m_line)
      MyString = MyString.strip("'[]")
      TempFile.write(MyString)
  
  
  MyFile.close()
  TempFile.close()
  </code></pre>
  
  <p>My input looks like this:</p>
  
  <pre><code>1 Jargon
  2 Python
  3 Yada Yada
  4 Stuck
  </code></pre>
  
  <p>My output when I do this is:</p>
  
  <pre><code>JargonPythonYada YadaStuck
  </code></pre>
  
  <p>I then modify the source code to this:</p>
  
  <pre><code>import string, io
  
  FileName = input("Arb File Name (.txt): ")
  
  MyFile = open(FileName, 'r')
  
  TempFile = open('TempFile.txt', 'w', encoding='UTF-8')
  
  for m_line in MyFile:
      m_line = m_line.strip()
      m_line = m_line.split(": ", 1)
      if len(m_line) &gt; 1:
          del m_line[0]
      #print(m_line)
      MyString = str(m_line)
      MyString = MyString.strip("'[]")
      #print(MyString)
      TempFile.write('\n'.join(MyString))
  
  
  MyFile.close()
  TempFile.close()
  </code></pre>
  
  <p>Same input and my output looks like this:</p>
  
  <pre><code>J
  a
  r
  g
  o
  nP
  y
  t
  h
  o
  nY
  a
  d
  a
  
  Y
  a
  d
  aS
  t
  u
  c
  k
  </code></pre>
  
  <p>Ideally, I would like each of the words to appear on a seperate line without the numbers in front of them.</p>
  
  <p>Thanks,</p>
  
  <p>MarleyH</p>