zoukankan      html  css  js  c++  java
  • 作业大礼包_员工信息表

    '''select name, age where age>22
    select * where job=IT
    select * where phone like 133'''
    def age_judge(than):
        l =[]
        f = open('info')
    
        if 'great'==than:
            for i in f:
                age = b[1].split('>')[1]
                age_info=i.split(',')[2]
                l.append(i.strip()) if age < age_info  else l
            f.close()
            return l
        elif 'small'==than:
            for i in f:
                age = b[1].split('<')[1]
                age_info=i.split(',')[2]
                l.append(i.strip()) if age > age_info  else l
            f.close()
            return l
        pass
    def job():
        l = []
        find_job=b[1].split('=')[1]
        f = open('info')
        for i in f:
            real_job=i.split(',')[4]
            l.append(i.strip()) if real_job==find_job else l
        f.close()
        return l
    def phone():
        l = []
        find_phone = b[1].split(' like ')[1]
        f = open('info')
        for i in f:
            real_phone = i.split(',')[3]
            l.append(i.strip()) if find_phone in real_phone else l
        f.close()
        return l
    def input_info_deal():
        if 'age'and'<' in b[1]:
            return age_judge('small')
        elif 'age'and'>' in b[1]:
            return age_judge('great')
        elif 'job' in b[1]:
            return job()
        elif 'phone' in b[1]:
            return phone()
    def end():
        end_deal=input_info_deal();
        if end_deal==[]:
            print('sorry,i can,t find your information')
        else:
            for i in end_deal:
                print(i.split(',')[1],i.split(',')[2])
    a= input('请输入你要查找的信息:')
    b = a.split(' where ')
    end()
  • 相关阅读:
    内置函数
    map,reduce和filter函数
    函数式编程和尾调用
    函数作用域,匿名函数
    全局变量和局部变量
    函数和过程
    百分号字符串拼接
    集合关系运算交,差,并集
    C#基础-压缩文件及故障排除
    【QQ】前端实现QQ会话功能
  • 原文地址:https://www.cnblogs.com/accolade/p/10495913.html
Copyright © 2011-2022 走看看