title: Find and replace values in a txt-file, using a dictionary
body: <p>I am writing a program where I need to prepare a text file for analysis (without the use of specific parsers, etc...).
  In a final step, I need to replace all accented characters with their unaccented counterpart, using a dictionary.</p>
  <p>As this is a school assignment, please just a reference to what I am missing, no complete codes ;-)</p>
  <p>This is what I have written.
  The plan was to have all the accented characters replaced in the original file. Instead, I am getting a complete blank file.</p>
  <p>Thanks for any help/pointers</p>
  <pre><code>#  decoding dictionary
  decode = {'à': 'a', 'á': 'a', 'ä': 'a', 'é': 'e', 'è': 'e', 'ê': 'e','î': 'i', 'í': 'i', 'ô': 'o', 'ö': 'o', 'ò': 'o', 'ó': 'o',
  'ù': 'u', 'ú': 'u', 'ü': 'u', 'ç': 'c', 'ß': 'b', 'ñ': 'n'}
  
  
  #  Open the source file
  f = open('spanish4.txt', 'w+', encoding='utf-8')
  text_input = f.read()
  
  #  read lines in the input file
  for line in text_input:
  
      #  compare input text to dictionary and replace if key is found
      for key in decode:
          if key in line:
              line.replace('d_key','d_value')
  f.close()
  </code></pre>