title: String Replacement and Saving to a New File (Python v2.7)
body: <p>I am trying to replace all lines of a certain format with a blanks in a file i.e. replace a line of number/number/number (like a date) and number:number (like a time)  with "". I want to read from the old file and then save the scrubbed version as a new file. </p>
  
  <p>This is the code I have so far (I know it is way off):</p>
  
  <pre><code>old_file = open("old_text.txt", "r")
  new_file = open("new_text.txt", "w")
  
  print (old_file.read())
  
  for line in old_file.readlines():
      cleaned_line = line.replace("%/%/%", "")
      cleaned_line = line.replace("%:%", "")
      new_file.write(cleaned_line)
  
  old_file.close
  new_file.close
  </code></pre>
  
  <p>Thank you for your help,
  Ben</p>