Dec-18-2018, 01:12 PM
Ok, so maybe the reason is elsewhere. I'm using a code looking like this:
Let me know if I'm not making any sense. I'm still learning an art of expressing your thoughts when it comes to programming issues :)
import csv, os os.chdir(r"C:\Users\me\Desktop\compare files") file1_list = [] file1 = open(r"file 1.csv") file1_reader_obj = csv.reader(file1) file1_data = list(file1_reader_obj) for row in file1_data: x = file1_data.index(row) file1_list.append(file1_data[x][1])And I just figured out I'm a moron since I already passed the file into list. So, I can use something like this to compare both files:
for row in file1_list: x = file1_list.index(row) if file1_list[x][1] in file2_list: continue else: print (RPT0706_list[x][1])Now the issue is that both files are structured like list of lists:
Output:[['1', 'a', 'a', 'a'],
['2', 'b', 'b', 'b'],
['3', 'c', 'c', 'c'],
['4', 'd', 'd', 'd'],
['5', 'e', 'e', 'e'],
['6', 'f', 'f', 'f']]
And I just have to check if the first item in the inner list of file1 (e.g 1, 2, 3, etc.) is listed as first item somewhere within inner lists in file2. Let me know if I'm not making any sense. I'm still learning an art of expressing your thoughts when it comes to programming issues :)