1 importos2 definquiry_system():3 welcome ='''
4 -----------员工信息查询系统------------5 操作说明:6 增加ADD:17 删除DELETE:28 修改CHANGE:39 查询SEARCH:410 退出QUIT:511 ---------------------------------------12 '''
13 print(welcome)14
15 defadd():16 #添加语法: name,age,phone,dept,enroll-date
17 add_staff =input('请输入要添加的员工信息:(添加格式: name,age,phone,dept(大写),enroll-date)\n')18 list_data =add_staff.split(',')19 list_all =[]20 f = open('staff_table.txt','r+',encoding='utf8')21 for line inf:22 list_all.append(line.strip().split(',')[3])23 if list_data[2] inlist_all:24 print('用户已存在!')25 f.close()26 else:27 for line inf:28 f.write(line)29 staff_id = str(len(list_all) + 1)30 list_data.insert(0, str(staff_id))31 f.write('\n')32 f.write(','.join(list_data))33 f.close()34 print('添加成功'