Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- d_csv2 = {}
- with open('subscriber_info 02212018.csv', 'r') as f_csv2:
- csv_2 = csv.reader(f_csv2)
- for cols in csv_2:
- d_csv2[cols[1]] = cols[0], cols[2]
- with open('subscribersWithMultipleDevices.csv', 'r') as f_csv1, open('output.csv', 'w', newline='') as f_output:
- csv_1 = csv.reader(f_csv1)
- csv_output = csv.writer(f_output)
- csv_output.writerow(['Customer', 'Email', 'First Name', 'Last Name', 'Serial Number', 'WAN MAC', 'IP ADD', 'Model',
- 'Last Contact', 'Circuit ID', 'n'])
- for cols in csv_1:
- try:
- if cols[6] in d_csv2:
- csv_output.writerow(cols + [d_csv2[cols[6]]])
- except KeyError:
- print('key error')
Add Comment
Please, Sign In to add comment