技术宅,fat-man

增加语言的了解程度可以避免写出愚蠢的代码

导航

2012年3月13日 #

python 文本比较

摘要: #!/usr/bin/env python# -*- coding: utf-8 -*-import difflibfrom difflib import *def compare(stream1,stream2): lines1 = stream1.splitlines() lines2 = stream2.splitlines() result=list(Differ().compare(lines1,lines2)) print str(result)if __name__ == '__main__': s1="hello\nword\nwww\n" 阅读全文

posted @ 2012-03-13 14:40 codestyle 阅读(623) 评论(0) 推荐(0)