Script: checked for duplicate account numbers.

This commit is contained in:
scoobybejesus 2020-11-27 12:57:12 -05:00
parent 29f84a30d3
commit 9a28bfbf64
1 changed files with 10 additions and 2 deletions

View File

@ -24,6 +24,7 @@
import csv import csv
import re import re
import os import os
import sys
unedited = "DigiTrnx.csv" # To be replaced with a launch arg, presumably unedited = "DigiTrnx.csv" # To be replaced with a launch arg, presumably
@ -47,6 +48,13 @@ with open(unedited) as fin, open(stage1, 'a') as fout:
wtr.writerow(header3) wtr.writerow(header3)
wtr.writerow(header4) wtr.writerow(header4)
# First, double check there are no account number duplicates
for i, val in enumerate(header):
if val != "":
if header.count(val) > 1:
print("### There is a duplicate account number (" + val +"). Please fix and re-run. ###")
sys.exit()
for row in rdr: for row in rdr:
if row[0] == "" or row[1] == "": if row[0] == "" or row[1] == "":
pass pass