Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Python to implement login query (can be fuzzy query)

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

# -*- 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. "

Query table: declaration. Phone numbers are random:

Implementation results:

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report