【python小程序】登錄及信息查詢系統

#!/usr/bin/env python

#FileName:dict.py

###################

# xiaoming:199199 #

# xiaohong:188188 #

# xiaolan:100100  #

###################

import getpass

running = True

while running:

        dict = {

                'xiaoming':199199,

                'xiaohong':188188,

                'xiaolan':100100

                }

        a = str(raw_input('login: '))

        if a in dict.keys():

b = int(getpass.getpass('password:'))

                c = int(dict[a])

                if b == c:

               print 'Login Success!Welcome %s!' %a

break

                else:

                        print 'Sorry,Login faild!'


        else:

                print 'Please check your name!'

continue

while running:

dict1 = {

'user1':"Tel:18800000001,Address:Beijing,Email:[email protected]",

'user2':"Tel:18800000002,Address:Shanghai,Email:[email protected]",

'user3':"Tel:18800000003,Address:Guangzhou,Email:[email protected]",

'user4':"Tel:18800000004,Address:Shenzhen,Email:[email protected]"

}

Name = str(raw_input('Please enter a name,logout please enter quit: '))

if Name == str('quit'):

break

else:

if Name in dict1.keys():

words = str(dict1[Name])

print "%s's words is %s." %(Name,words)

continue

else:

print 'Please check your name!'

continue

print 'Bye Bye!!!'


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章