title: how to delete duplicate lines in a file in Python
body: <p>I have a file with duplicate lines. What I want is to delete one duplicate to have a file with unique lines. But i get an error <strong>output.writelines(uniquelines(filelines))
  TypeError: writelines() argument must be a sequence of strings</strong> 
  I have searched the same issues but i still don-t understand what is wrong.
  My code:</p>
  
  <pre><code>def uniquelines(lineslist):
      unique = {}
      result = []
      for item in lineslist:
          if item.strip() in unique: continue
          unique[item.strip()] = 1
          result.append(item)
      return result
  file1 = codecs.open('organizations.txt','r+','cp1251')
  filelines = file1.readlines()
  file1.close()
  output = open("wordlist_unique.txt","w")
  output.writelines(uniquelines(filelines))
  output.close()
  </code></pre>