def getinfo(empno): with open(filepath) as f: lines = f.readlines() for line in lines: empdata = line.split() if int(empdata[0]) == empno: emp = Emp() # 객체 생성 emp.empno = int(empdata[0]) emp.ename = empdata[1] emp.dept = int(empdata[2]) emp.sal = int(empdata[3]) emp.loc = empdata[4] emp.tel = empdata[5] emp.email = empdata[6] return emp
def getlist(): with open(filepath) as f: lines = f.readlines() emplist = [] for line in lines: empdata = line.split() emp = Emp() # 객체 생성 emp.empno = int(empdata[0]) emp.ename = empdata[1] emp.dept = int(empdata[2]) emp.sal = int(empdata[3]) emp.loc = empdata[4] emp.tel = empdata[5] emp.email = empdata[6] emplist.append(emp) return emplist