def input_display(): id = input("아이디: ") name = input("이름: ") age = input("나이: ") while not age.isdecimal(): print("나이는 18이상의 숫자로 입력해주세요.") age = input("나이: ") major = input("전공: ") return Student(id, name, int(age), major)
def init_data_load() : students = [] fileExist = os.path.isfile("students.dat") if fileExist : read_file = open("students.dat","r") while True : data = read_file.readline() if len(data.split("|")) == 2 : student = data.split("|")[1].strip("\n").split(", ") students.append(Student(student[0].strip(), student[1].strip(), int(student[2].strip()), student[3].strip())) if not data : break read_file.close() return students