| [ Web Proxy ] |
| Viewing: https://raw.githubusercontent.com/nacyot/python_reference/master/diff_files.py | [Back] [Original] |
# Sebastian Raschka, 2014
#
# Print lines that are different between 2 files. Insensitive
# to the order of the file contents.
id_set1 = set()
id_set2 = set()
with open('id_file1.txt', 'r') as id_file:
for line in id_file:
id_set1.add(line.strip())
with open('id_file2.txt', 'r') as id_file:
for line in id_file:
id_set2.add(line.strip())
diffs = id_set2.difference(id_set1)
for d in diffs:
print(d)
print("Total differences:",len(diffs))
| Web Proxy Viewer | New URL | Original Page |