Guest User

Untitled

a guest
Jul 16th, 2020
8
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with open(filename1) as f1, open9filename2) as f2:
  2. data_1 = list(csv.reader(f1))
  3. data_2 = list(csv.reader(f2))
  4.  
  5. d = {}
  6.  
  7. for row in data1:
  8. d[row[0]] = row
  9.  
  10. for row in data2:
  11. if row[0] in d:
  12. f1_row = d[row[0]]
  13. merge_somehow(row, f1_row)
  14. else:
  15. row[whatever] = "N/A"
  16. write_data_back_to_file_somehow(data2)
RAW Paste Data