-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.py
35 lines (24 loc) · 927 Bytes
/
data.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
import copy
def readProjectsFromFile(fileName="projects.txt"):
with open(fileName) as file:
theProjects = file.readlines()
theProjects = [project.strip().strip("\"'\n\r")
for project in theProjects]
return theProjects
def readStudentPrefrencesFromFile(fileName="students.txt"):
with open(fileName) as file:
lines = file.readlines()
theStudents = [
{
"Name": (student.split(",")[0]).strip().strip("\"'\n\r"),
"Prefrences":[pref.strip().strip("\"'\n\r") for pref in student.split(",")[1:]],
"assigned": False,
} for student in lines
]
return theStudents
Projects = readProjectsFromFile("projects.csv")
Students = readStudentPrefrencesFromFile("students.csv")
def getProjects():
return copy.deepcopy(Projects)
def getStudents():
return copy.deepcopy(Students)