Created
November 20, 2015 07:46
-
-
Save Lewuathe/4fdb63f59ec6b3b38fd5 to your computer and use it in GitHub Desktop.
Take character base difference
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os | |
def diff(file1, file2): | |
with open(file1, 'r') as f1: | |
file1_content = f1.read() | |
with open(file2, 'r') as f2: | |
file2_content = f2.read() | |
zipped = zip(file1_content, file2_content) | |
print file1_content | |
for i, (a, b) in enumerate(zipped): | |
if a != b: | |
print i, a, b | |
if __name__ == "__main__": | |
ret = diff('./a', './b') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment