2017-09-21 21:42:57 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""python diff.py file1 file2 diff"""
|
|
|
|
|
2015-06-23 04:49:25 +00:00
|
|
|
import difflib
|
|
|
|
import sys
|
|
|
|
|
|
|
|
diff = difflib.unified_diff(
|
2020-02-22 18:06:15 +00:00
|
|
|
open(sys.argv[1], encoding='utf-8').readlines(),
|
|
|
|
open(sys.argv[2], encoding='utf-8').readlines())
|
|
|
|
with open(sys.argv[3], 'w', encoding='utf-8') as f:
|
2017-09-21 21:42:57 +00:00
|
|
|
f.write(''.join(diff))
|