• python 写的员工信息查询


    #!/use/bin/env pythonn
    #_*_ coding:utf-8 _*_
    import time
    def Bre():
        while True:
            Bre_falg = raw_input("是否还要继续查找(y/n)")
            if Bre_falg == 'y' or Bre_falg == 'n':
                return Bre_falg
            else:
                print("您输入错误请重新输入!.......")
    file = file('information.txt','r')
    file_info = file.readlines()
    file.close
    print ("===========欢饮来到员工信息查询表================= 请你愉快查询 ")
    Bre_falg=''
    while Bre_falg !='n':
        while True:
            information=raw_input('请输入你要查找的信息:')
            if len(information)>2:
                break
            else:
                print('您输入的信息太少,请在重新输入.....')
        count_number=0
        new_file_list=[]
        for i in file_info:
            if i.count(information)>0:
                new_file_list.append(i.replace(information,"33[42;31;1m%s33[0m" % information))
                count_number +=1
        if count_number>0:
            print("共查到:33[42;31;1m%s33[0m条信息" % count_number)
            for i in new_file_list:
             print i
        else:
            print("没有您要查找的信息")
        Bre_falg=Bre()
        
    for i in range(3):
        print '''33[31;5m谢谢使用员工信息查询系统,%s秒后,退出系统33[0m''' % (3-i)
        time.sleep(1)
    exit("您一退出系统")

    下面是文件information.txt

    name:marry  age:23  sex:man  job:IT teh:12345678  mail:1253153
    name:song dada  age:23  sex:man  job:HR teh:0988777 mail:14214
    name:zhang sanfeng  age:23  sex:man  job:IT teh:987544 mail:09789
    name:zhang wuji  age:23  sex:man  job:accountant teh:12349876 mail:16397
    name:ling huchong  age:23  sex:man  job:IT teh:48645678 mail:126dfsf
    name:xiaoping  age:23  sex:man  job:manager teh:7807554 mail:245454
    name:li yuanfang  age:23  sex:man  job:IT teh:1356781 mail:126126
    name:feng feng  age:23  sex:man  job:boss teh:12335436 mail:163163

  • 相关阅读:
    cg数据类型
    线程和流的历史遗留
    流的总结及小问题

    集合练习
    集合属性的整理
    集合
    整理
    面向对象中知识的薄弱点
    自己的小问题和数组常用的方法
  • 原文地址:https://www.cnblogs.com/houchaoying/p/8657522.html
Copyright © 2020-2023  润新知