1
|
class CSVDataLine:
|
2
|
"""
|
3
|
Class that specifies the look of data line in processed csv file
|
4
|
prepared for database
|
5
|
"""
|
6
|
|
7
|
def __init__(self, name, date, occurrence):
|
8
|
try:
|
9
|
test_val = int(occurrence)
|
10
|
except ValueError:
|
11
|
print("Occurence should be and integer value!")
|
12
|
|
13
|
if len(date) != 13:
|
14
|
raise ValueError("Invalid date format YYYY-dd-mm-hh expected!")
|
15
|
|
16
|
self.name = name
|
17
|
self.date = date
|
18
|
self.occurrence = test_val
|
19
|
|
20
|
def to_csv(self):
|
21
|
return self.name + ";" + str(self.occurrence) + ";" + self.date
|
22
|
|