title: Python script that surrounds each line in file with apostrophe
body: <p>I am trying to run a Python script that takes an input file, manipulate it's content and writes the result to an output file.</p>
  
  <p>I want to surround every line with quotes.
  Currently I created the script below.</p>
  
  <pre><code>import sys
  import re
  
  inFile = sys.argv[1]
  outFile = sys.argv[2]
  
  with open(inFile,'r') as i:
      lines = i.readlines()
  
  
  def manipulate_data(lines):
      content = [x.rstrip('\n') for x in lines]
  
      res = [re.sub(r"(.+)", r"'\g&lt;0&gt;',", y) for y in content]
      return res
  
  
  processedLines = manipulate_data(lines)
  
  with open(outFile,'w') as o:
      for line in processedLines:
          o.write(line)
  </code></pre>
  
  <p>I run it with <code>python3 script.py input.txt output.txt</code></p>
  
  <p>It runs, but I wish to change this so that it writes to the output file line by line. I also feel like I am unnecessarily using <code>[do_something for something in somethings]</code> twice. </p>
  
  <p>How can I achieve my desired result?</p>