-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathio_handler.py
More file actions
24 lines (21 loc) · 825 Bytes
/
io_handler.py
File metadata and controls
24 lines (21 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import csv
from Station import Station
from Network import ColoredNetwork
def network_processer(file_path):
nodes = []
with open(file_path, 'r', encoding='utf-8-sig') as csvfile:
data = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in data:
name = row[0]
color = row[1]
connections = [connection for connection in row[2:] if connection != '']
node = Station(name, connections, color)
nodes.append(node)
return nodes
def get_start_end(nodes):
start_name = input("Ingrese el nombre de la estación de inicio: ")
end_name = input("Ingrese el nombre de la estación de fin: ")
return start_name, end_name
def get_color():
color = input("Ingrese el color del tren (Enter si no tiene color): ")
return color