delete overlapping line


/ Published in: Python
Save to your folder(s)

This script is used for the sorted text.


Copy this code and paste it in your HTML
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. filein = "./inputdata.txt"
  5. fileout = "./outputdata.txt"
  6.  
  7. r = open(filein,'r')
  8. w = open(fileout,'w')
  9. tmp = ""
  10.  
  11. for line in r:
  12. if (tmp != line):
  13. w.write(line)
  14. tmp = line
  15.  
  16. r.close()
  17. w.close()

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.