-
Notifications
You must be signed in to change notification settings - Fork 0
/
landmarksHelper.py
54 lines (36 loc) · 1.05 KB
/
landmarksHelper.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def readCSV(filename):
fd = open(filename, "r")
lines = fd.readlines()
names = lines[0].strip().split(", ")
print(names)
final_list = []
for i in range(1, len(lines)):
values = lines[i].strip().split(", ")
if len(values) != len(names):
values = lines[i].strip().split(",")
dict_info = {}
for j in range(len(names)):
dict_info[names[j]] = values[j].strip()
final_list.append(dict_info)
return final_list
def recover_landmarks():
#@ return: list of monuments names
res = []
fd = open("landmarks.csv", "r")
lines = fd.readlines()
lines = lines[1:]
for line in lines:
splitted = line.strip().split(", ")
res.append(splitted[0])
fd.close()
return res
def recover_distances():
#@ return: list of dict with key "Start" "End" "Seconds" and "Transport"
res = []
fd = open("distance.csv", "r")
lines = fd.readlines()
for i in range(1, len(lines)):
splitted = lines[i].strip().split(", ")
res.append({"Start": splitted[0], "End": splitted[1], "Seconds": splitted[2], "Transport": splitted[3]})
fd.close()
return res