Python比较字符串差异
# !/usr/bin/python
import difflib
text1 = """
字符串1
"""
text1_lines = text1.splitlines()
text2 = """
字符串2
"""
text2_lines = text2.splitlines()
d = difflib.Differ()
diff = d.compare(text1_lines, text2_lines)
print('\n'.join(list(diff)))