Question: def readFromFile(self, filename: str): read the student name and courses from the specified file and adds them to the list of courses:param filename: name of
def readFromFile(self, filename: str): """read the student name and courses from the specified file and adds them to the list of courses:param filename: name of file to read the data from; the format of the file must match the format the writeToFile method produces """ f = open(filename, 'r') c = file.readlines() self.none = c[0] for i in range(1, len(c)): self.addCourse(Course.fromCSV(c[i])) file.close()
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
