title: Python how to replace values in one list with values in a dictionary?
body: <p>example:</p>
  
  <p>my list is <code>['tree'，'world'，'tre'，'worl']</code></p>
  
  <p>my dict is <code>{'tre':'good','worl':nice}</code></p>
  
  <p>my scripts:</p>
  
  <pre><code>def replace(list, dictionary):
      for i in list:
          for k in dictionary:
              list = list.replace(k, dictionary[k])
      return list
  print replace(input_file,curaw_dict)
  </code></pre>
  
  <p>but every time I receive the result is like：</p>
  
  <pre><code>goode
  niced
  good
  nice
  </code></pre>
  
  <p>how can I make it more accurate
  make it like </p>
  
  <pre><code>tree
  world
  good
  nice
  </code></pre>
  
  <p>Thanks alot</p>