python实现登录查询(可以模糊查询)
# -*- coding: utf-8 -*- while 1: name= raw_input("Please input your name:") if name == "zhangsan": password = raw_input("Please input your password:") while password != "zhangsan": password = raw_input("password error,Please input your password again:") else: print "Login successful." print "welcome to search address list." while 1: match_yes = 0 search = raw_input("please input name whom you want to search.") contact_file = file('address_list.txt') while 1: line = contact_file.readline() if len(line) == 0:break if search in line: print 'Congratulations:\n\n %s' % line match_yes = 1 if match_yes == 0: print "Sorry,not found" else: print "username error,try again."
查询的表:声明。电话号都是随便打的:
创新互联建站是一家集网站建设,河源企业网站建设,河源品牌网站建设,网站定制,河源网站建设报价,网络营销,网络优化,河源网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。
执行结果:
名称栏目:python实现登录查询(可以模糊查询)
本文路径:http://scgulin.cn/article/ihoeph.html