Skip to content

Instantly share code, notes, and snippets.

@Lewuathe
Created November 20, 2015 07:46
Show Gist options
  • Save Lewuathe/4fdb63f59ec6b3b38fd5 to your computer and use it in GitHub Desktop.
Save Lewuathe/4fdb63f59ec6b3b38fd5 to your computer and use it in GitHub Desktop.
Take character base difference
#!/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