title: Deleting carriage returns caused by line reading
body: <p>I have a list:</p>
  
  <pre><code>Cat
  Dog
  Monkey
  Pig
  </code></pre>
  
  <p>I have a script:</p>
  
  <pre><code>import sys
  input_file = open('list.txt', 'r')
  for line in input_file:
      sys.stdout.write('"' + line + '",')
  </code></pre>
  
  <p>The output is:</p>
  
  <pre><code>"Cat
  ","Dog
  ","Monkey
  ","Pig",
  </code></pre>
  
  <p>I'd like:</p>
  
  <pre><code>"Cat","Dog","Monkey","Pig",
  </code></pre>
  
  <p>I can't get rid of the carriage return that occurs from processing the lines in the list. Bonus point for getting rid of the , at the end. Not sure how to just find and delete the last instance.</p>