title: How to return unique words from the text file using Python
body: <p>How do I return all the unique words from a text file using Python?
  For example:</p>
  <blockquote>
  <p>I am not a robot</p>
  <p>I am a human</p>
  </blockquote>
  <p>Should return:</p>
  <blockquote>
  <p>I</p>
  <p>am</p>
  <p>not</p>
  <p>a</p>
  <p>robot</p>
  <p>human</p>
  </blockquote>
  <p>Here is what I've done so far:</p>
  <pre><code>def unique_file(input_filename, output_filename):
      input_file = open(input_filename, 'r')
      file_contents = input_file.read()
      input_file.close()
      word_list = file_contents.split()
  
      file = open(output_filename, 'w')
  
      for word in word_list:
          if word not in word_list:
              file.write(str(word) + &quot;\n&quot;)
      file.close()
  </code></pre>
  <p>The text file the Python creates has nothing in it. I'm not sure what I am doing wrong</p>