I have two CSV files with the same row names:
Name, Lastname.
However, file2.csv has an extra column named
Attention
Each file has a different list of name and lastname (not in order). I'm trying to find a way to find to print the attention column, if the name and lastname are in both files.
This is what I have so far:
with open('result.csv') as r:
set1 = set(x[0] for x in csv.reader(r))
with open('result2.csv') as r:
set2 = set(x[0] for x in csv.reader(r))
for x, y in zip(set1, set2):
if x[0] == y[0]:
print("Matched")
How can I read the first and second column for each file?
Thank you
edit: being more clear
x[1]?