#!/usr/bin/python whileTrue: input = raw_input("pelease inputyour name:") if input == ‘leo‘: password =raw_input("pelease input your password:") p = ‘123‘ while password != p: password =raw_input("Wrong password,input again:") else: print "welcome loginon" break else: print "sorry,user %s notfind" % input
[root@localhost script]# python while2.py pelease input your name:leo pelease input your password:123 welcome login on
本文出自 “梁恩宇-9527” 博客,请务必保留此出处http://liangey.blog.51cto.com/9097868/1661027
原文:http://liangey.blog.51cto.com/9097868/1661027