title: Replacing a word in a file
body: <pre><code>badcontent = []
  filebadword = "badwords.txt"
  with open(filebadword, 'r') as read_file:
    badcontent = read_file.readlines()
  
  goodcontent = []
  filegoodword = "goodword.txt"
  with open(filegoodword, 'r') as read_file:
    goodcontent = read_file.readlines()
  
  
  msgfile = "msg.txt"
  file = open(msgfile, "r")
  for word in file:
    if word in badcontent:
      file = file.write(word.replace([badcontent],[goodconent]))
      print(file.readline())
      file.close()
    elif():
      print(file.readline())
      file.close()
  </code></pre>
  
  <p>I want to try replace a 'inappropriate' word in the text msg file with a friendly word.</p>