diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/closures.py b/closures.py old mode 100644 new mode 100755 diff --git a/cpu_time.py b/cpu_time.py old mode 100644 new mode 100755 diff --git a/diff_files.py b/diff_files.py new file mode 100644 index 0000000..5e36a7c --- /dev/null +++ b/diff_files.py @@ -0,0 +1,21 @@ +# 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) + +with open('id_file2.txt', 'r') as id_file: + for line in id_file: + id_set2.add(line) + +diffs = id_set2.difference(id_set1) + +for d in diffs: + print(d) +print("Total differences:",len(diffs)) diff --git a/get_filename.py b/get_filename.py old mode 100644 new mode 100755 diff --git a/pickle_module.py b/pickle_module.py old mode 100644 new mode 100755 diff --git a/read_file.py b/read_file.py old mode 100644 new mode 100755