Python学习——实现简单的交互raw_input的使用
# cat mulit_loop.py#!/bin/python
passwd="test"
logout=False #加跳出的flag
for i in range(3):
password=raw_input("Please input your password:").strip()
if len(password)==0:
continue
if password==passwd:
print "Welcome to login!"
while True:
user_select=raw_input('''
====================================
Please input a number to continue
1.Send files;
2.Send emalis;
3.exit this level;
4.exit the whole loop.
====================================
''').strip()
user_select=int(user_select)
if user_select==1:
print "Sending files as you wish!"
if user_select==2:
print "Sending emails as you wish!"
if user_select==3:
print "Exit this level,please re-input the password!"
break
if user_select==4:
print "Ok, let's have a break!"
logout=True
break
if logout==True:
break
页:
[1]