Python登录模块Demo示例

Python登录模块Demo示例:

#!/usr/bin/env python
# This content comes from alex.

while True:
    NAME = raw_input("Please input your name:\n")
    if NAME == 'alex':
        P = '123'
        PASSWD = raw_input("Please input your password:\n")
        while PASSWD != P:
            PASSWD = raw_input("Please input your password:\n")
        else:
            print "Welcome to %s login to Syetem.\n" % NAME
            #break
            while True:
                match_yes = 0 
                Search = raw_input("Please input your want to search String:")
                content_file = file('contact_list.txt')
                while True:
                    line = content_file.readline()
                    if len(line) == 0:break
                    if Search in line:
                        print 'Match item: \033[36:1m%s\033[0m' % line
                        match_yes = 1 
                    else:
                        pass
                if match_yes == 0:
                    print 'No match item found.'
    else:
        print "Sorry, user %s not found" % NAME


你可能感兴趣的:(python,登录模块,Demo示例)