python 文本比较
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import difflib
from 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"
s2="hello\nworld"
compare(s1,s2)