Python 官方文档:入门教程 => 点击学习
#!/usr/bin/env python import difflibimport sys try:tx1 = sys.argv[1]tx2 = sys.argv[2]except Exception as e:print "error"
#!/usr/bin/env python
import difflib
import sys
try:
tx1 = sys.argv[1]
tx2 = sys.argv[2]
except Exception as e:
print "error" + str(e)
print "usage: xx filename1 filename2"
sys.exit()
def readf(fn):
try:
fileH = open(fn, 'rb')
text = fileH.read().splitlines()
fileH.close()
return text
except Exception as e:
print "error: " + str(e)
system.exit()
if name == "main":
tx1_line = readf(tx1)
tx2_line = readf(tx2)
d = difflib.htmlDiff()
print d.make_file(tx1_line,tx2_line)
--结束END--
本文标题: python对比配置文件差异
本文链接: https://lsjlt.com/news/186079.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0