'''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()