-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathValidate.py
39 lines (27 loc) · 856 Bytes
/
Validate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import csv
import sys
import os
import datetime
def validate(date_text, counter):
try:
datetime.datetime.strptime(date_text, '%H:%M:%S')
except ValueError:
print(date_text)
counter+=1
return counter
with open(sys.argv[1], newline='') as file:
entry = csv.reader(file)
file.seek(0)
next(entry, None)
count_crm = 0
count_lvl = 0
for row in entry:
if row[10] != "":
row[10].upper()
if row[10] not in ['ATTEMPTED', 'COMPLETED']:
count_crm+=1
if row[11] != "":
row[11].upper()
if row[11] not in ['FELONY', 'MISDEMEANOR', 'VIOLATION']:
count_lvl+=1
print(count_crm, count_lvl)