python 텍스트 비교

1242 단어 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
word
www
"
s2="hello
world
"
compare(s1,s2)

좋은 웹페이지 즐겨찾기