Mar-30-2021, 12:47 AM
Using the example above
with open('f1.txt', 'r') as file: lines = set([line.strip().split(',')[3] for line in file]) with open('f2.txt', 'r') as file: for line in file: line = line.strip() if line.split(',')[3] not in lines: print(f'{line} NO MATCH')
Output:03/28/2021,P,16,LINE1 NO MATCH
03/28/2021,P,9,LINE3 NO MATCH
03/28/2021,P,8,LINE5 NO MATCH
03/28/2021,S,95,LINE6 NO MATCH
03/28/2021,S,1,LINE7 NO MATCH
03/28/2021,P,46,LINE8 NO MATCH
I welcome all feedback.
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts
The only dumb question, is one that doesn't get asked.
My Github
How to post code using bbtags
Download my project scripts