Personal Project Portfolio
python bash powershell
at main 18 lines 655 B view raw
1# This script will find differences between two csv files text strings 2# and write any missing lines to a new file 3 4#import csv module 5import csv 6 7# use open method to instantiate both files 8# replace filenames with local files, files must be in same folder as script file 9with open('<filename>', 'r') as f1, open('<filename2>', 'r') as f2: 10 f1_lines = f1.readlines() 11 f2_lines = f2.readlines() 12 13# use open method to iterate through both files looking for matches 14# write non-matches to new file 15with open('<outputfilename>', 'w') as difference_file: 16 for line in f1_lines: 17 if line not in f2_lines: 18 difference_file.write(line)