title: Replace char at position in each element
body: <p>I have a txt file filled with data, I want to write each line of my text to elements of a list called <code>DATA</code> in Python, each line/element looks like this:</p>
  <pre><code>data[0] = EPH21 2017-05-05T00:30    2375.50 2376.50 2375.50 2376.50 712 0
  data[1] = EPH21 2017-05-05T01:00    2376.50 2376.75 2375.50 2375.75 821 0
  data[2] = EPH21 2017-05-05T01:30    2376.00 2376.00 2374.75 2375.25 1453 0
  </code></pre>
  <p>I want to modify each line/element to have <code>&quot;,&quot;</code> instead of spaces, so it looks like a CSV file.
  Also I want to replace the <code>&quot;T&quot;</code> contained in the timestamps with <code>&quot;,</code>&quot; as well.
  In the end I want to write the modified list into a new text file.</p>
  <p>After the changes I want my list to look like this:</p>
  <pre><code>data[0] = EPH21,2017-05-05,00:30,2375.50,2376.50,2375.50,2376.50,712,0
  data[1] = EPH21,2017-05-05,01:00,2376.50,2376.75,2375.50,2375.75,821,0
  data[2] = EPH21,2017-05-05,01:30,2376.00,2376.00,2374.75,2375.25,1453,0
  </code></pre>
  <p>How can I do this?
  I tried with this code but no luck so far:</p>
  <pre><code>file = open(&quot;EPH21_30 Minutes.txt&quot;, &quot;r&quot;)
  data = []
  for line in file:
      data.append(line)
      
  for element in data:
      element.replace(&quot; &quot;, &quot;,&quot;)
      element.replace(&quot;T&quot;, &quot;,&quot;)
  
  MyFile = open('output.txt','w')
  for element in data:
      MyFile.write(element)
      MyFile.write('\n')
  MyFile.close()
  
  </code></pre>