1 |
c8f3051b
|
petrh
|
from Utilities.CSV import CSVDataLine, CSVutils
|
2 |
|
|
from Utilities import DateFormating
|
3 |
|
|
|
4 |
|
|
|
5 |
|
|
def process_file(filename):
|
6 |
|
|
|
7 |
|
|
with open(filename, "r") as file:
|
8 |
|
|
|
9 |
|
|
date_dict = dict()
|
10 |
|
|
|
11 |
|
|
for line in file:
|
12 |
|
|
|
13 |
|
|
array = line.split(";")
|
14 |
|
|
|
15 |
|
|
date = DateFormating.date_time_formater(array[0][1:-1])
|
16 |
|
|
name = array[1][1:-1]
|
17 |
|
|
|
18 |
|
|
if date not in date_dict:
|
19 |
|
|
date_dict[date] = dict()
|
20 |
|
|
|
21 |
|
|
if name in date_dict[date]:
|
22 |
|
|
date_dict[date][name].occurence += 1
|
23 |
|
|
else:
|
24 |
|
|
date_dict[date][name] = CSVDataLine.CSVDataLine(name, date, 1)
|
25 |
|
|
|
26 |
|
|
CSVutils.export_data_to_csv(filename, date_dict)
|