def __init__(self, path): """read file""" try: self.instructor_list = file_reading_gen(path, 3, sep='\t', header=False) except ValueError: """can be changed in future homework""" raise ValueError self.instructor_dict = defaultdict(dict)
def __init__(self, path): try: self.major_list = list( file_reading_gen(path, 3, sep='\t', header=True)) except ValueError: """Dirty data""" print("Dirty data in majors.txt") except FileNotFoundError: """Data not found""" print("Can not found majors.txt")
def __init__(self, path): """read file""" try: self.instructor_list = list( file_reading_gen(path, 3, sep='|', header=True)) except ValueError: """can be changed in future homework""" print("Dirty data in instructor.txt") except FileNotFoundError: """Data not found""" print("Can not found instructor.txt") self.instructor_dict = defaultdict(dict)
def __init__(self, path): try: self.grade_list_pre = list( file_reading_gen(path, 4, sep='|', header=True)) except ValueError: """can be changed in future homework""" print("Dirty data in grades.txt") except FileNotFoundError: """Data not found""" print("Can not found grades.txt") self.grade_list = [ item for item in self.grade_list_pre if item[2] not in ['D', 'E', 'F'] ]
def __init__(self, path): try: self.grade_list = list(file_reading_gen(path, 4, sep='\t', header=False)) except ValueError: """can be changed in future homework""" raise ValueError