• 员工管理信息的删增功能


    # ##员工信息
    # 1.可进行模糊查询,语法至少支持下面3中:
    #     1.select name ,age from staff_table where age>22
    #     选择姓名,年龄在22岁以上的员工的年龄
    #     2.select * from staff_table where dept = "it"
    #     从员工表中选择“it”
    #     3.select * from staff_table where enroll like "2013"
    #     从员工表中选择“2013”
    #     4.查到的信息,打印后,到最后还要显示查到的条数
    # 2.可创建新员工记录,以phone做唯一键,staff_id需要自增
    # 3.可删除指定员工信息,输入id名即可删除
    # 4.可修改员工信息,语法如下:
    #     update staff_table set dept = “Market” where dept = “IT”
    #     更新stafftable集dept="Market",其中部门="IT"
    
    ##读取数据列表
    EmployeesList = []
    def CirculationList(ReaDinG):
        for ReaDLine in ReaDinG:
            ReaDList = ReaDLine.strip("
    ").split(",")
            EmployeesList.append(ReaDList)
            # print(ReaDList)
    def list_():
        print("编号	姓名		性别	年龄	职位	电话		 入职日期")
        for Employees in EmployeesList:
            print("%s		%s		%s		 %s		%s		%s	 %s" % (Employees[0],
                                                              Employees[1],
                                                              Employees[2],
                                                              Employees[3],
                                                              Employees[4],
                                                              Employees[5],
                                                              Employees[6]))
    
    ##员工读取数据列表
    ReaDing = open("file_1.txt","r",encoding="utf-8")
    ReaDinG = ReaDing.readlines()
    ReaDList = CirculationList(ReaDinG)
    ReaDing.close()
    n = 0
    while n<1:
        list_()
        print("*"*65)
        print("查询/创建/删除/修改")
        EmployeesInput = input("选择您的操作->")
        if EmployeesInput == "查询":
            print("姓名/年龄/2013")
        elif EmployeesInput =="创建":
            serialNumber = "G%d"% (len(EmployeesList)+ 1)
            nameIn = input("请您输入姓名:-》")
            genderIn = input("请您输入性别:-》")
            ageIn = input("请您输入年龄:-》")
            jobIn = input("请您输入职位:-》")
            phoneIn = input("请您输入电话:-》")
            dateIn = input("请您输入入职日期:-》")
            creator = [serialNumber,nameIn,genderIn,ageIn,jobIn,phoneIn,dateIn]
    
            EmployeesList.append(creator)
            print("您成功添加了%s" % nameIn)
            continue
        elif EmployeesInput =="删除":
            nameInr = input("请输入要删除的员工:")
            for NameInr in EmployeesList:
                i = 0
                if NameInr[1] == nameInr:
                    print(NameInr[1])
                    EmployeesList.remove(NameInr)
    
                    Reaing = open("file_1.txt", "w", encoding="utf-8")
                    for ReainG in EmployeesList:
                        ReanG = ','.join(ReainG)+"
    "
                        Reaing.write(ReanG)
    
                    Reaing.close()
    
                    break
                i += 1
        else:##修改
            pass
        n+=1
    以上内容作为课堂笔记,如有雷同,请联系于我
  • 相关阅读:
    二叉树之小球下落
    ACM规划型。。
    经典函数看待问题。。
    用putty连接ubuntu
    minheight最小高度的实现(兼容IE6、IE7、FF)(解决IE6不兼容minheight)
    elementui里面的form表单i验证input内容已经输入不为空了,但效验还是报错不能为空
    js中10位数的时间戳必须*1000才能格式化转换
    chrome已安装Vue Devtools在控制台却无显示
    elementui使用day.js格式化后端接口里的日期时间戳
    elementui分页更改后,需要再次调用获取列表数据函数
  • 原文地址:https://www.cnblogs.com/ArtisticMonk/p/8933531.html
Copyright © 2020-2023  润新知