码迷,mamicode.com
首页 > 其他好文 > 详细

txt去重

时间:2015-10-05 19:37:11      阅读:248      评论:0      收藏:0      [点我收藏+]

标签:python

#encoding:utf-8
obuff = []
repeat = 0
path = raw_input(‘please input your path:  ‘)
for ln in open(path):
    if ln in obuff:                  
    	repeat+=1
        continue
    obuff.append(ln)
print "repeat columns is %s"  %repeat
with open(path, ‘w‘) as handle:
    handle.writelines(obuff)


本文出自 “安全” 博客,请务必保留此出处http://wushang.blog.51cto.com/10078847/1700263

txt去重

标签:python

原文地址:http://wushang.blog.51cto.com/10078847/1700263

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!