def buyshopping(): showshopping() global moneynum #使用全局变量,目的是将需要支付的钱 flag = 0 while flag <= 3: choiceshoptry = raw_input('''请确认你本次消费总金额为%s元[y/n]''' % moneynum).strip() if len(choiceshoptry) == 0: flag += 1 print "输入不能为空,请重新输入[y/n]确认!" else: if choiceshoptry == 'Y' or choiceshoptry == 'y' or choiceshoptry == 'N' or choiceshoptry == 'n': if choiceshoptry == 'y' or choiceshoptry == 'Y': orders() # print '跳转到信用卡支付页面' banklogin.bank_login() if choiceshoptry == 'n' or choiceshoptry == 'N': print '你本次确认不结算购物车内商品!%s' % time.strftime( '%Y-%m-%d %H:%M:%S', time.localtime( time.time())) #格式化输出当前时间2015-11-29 15:39:30 break else: flag += 1 print "你的输入有误,请重新输入[y/n]!" print "系统将退出购物车!" time.sleep(1)
def welcome(): flag = 0 while flag < 5: userInput = raw_input(''' \t\t\t欢迎光临"南非波波小屋"\t\t\t 在这里你可以购买二手数码产品,还可以进入信用卡交易中心进行相应操作! 请选择相应的指令进入不同的界面! \t二手数码产品:1\t信用卡中心:2\t退出:3\t 请输入你要进入的界面指令[1-3]:''').strip() if userInput.isdigit(): if int(userInput) == 1: shoplogin.shop_login() if int(userInput) == 2: banklogin.bank_login() if int(userInput) == 3: print "系统即将退出,欢迎下次光临!" time.sleep(1) sys.exit() if int(userInput) != 1 and int(userInput) != 2 and int( userInput) != 3: print "你输入的指令数字已超出范围!请输入正确的指令[1-3].." flag += 1 else: print "系统只接受数字类型指令,请输入正确的指令[1-3]!" flag += 1 print "你输入的错误次数已达5次,程序即将退出!感谢你的使用!" time.sleep(1) sys.exit(1)
def welcome(): flag = 0 while flag < 5: userInput = raw_input(''' \t\t\t欢迎光临"南非波波小屋"\t\t\t 在这里你可以购买二手数码产品,还可以进入信用卡交易中心进行相应操作! 请选择相应的指令进入不同的界面! \t二手数码产品:1\t信用卡中心:2\t退出:3\t 请输入你要进入的界面指令[1-3]:''').strip() if userInput.isdigit(): if int(userInput) == 1: shoplogin.shop_login() if int(userInput) == 2: banklogin.bank_login() if int(userInput) == 3: print "系统即将退出,欢迎下次光临!" time.sleep(1) sys.exit() if int(userInput) != 1 and int(userInput) != 2 and int(userInput) != 3: print "你输入的指令数字已超出范围!请输入正确的指令[1-3].." flag += 1 else: print "系统只接受数字类型指令,请输入正确的指令[1-3]!" flag += 1 print "你输入的错误次数已达5次,程序即将退出!感谢你的使用!" time.sleep(1) sys.exit(1)
def buyshopping(): showshopping() global moneynum #使用全局变量,目的是将需要支付的钱 flag = 0 while flag <= 3: choiceshoptry = raw_input('''请确认你本次消费总金额为%s元[y/n]''' % moneynum).strip() if len(choiceshoptry) == 0: flag += 1 print "输入不能为空,请重新输入[y/n]确认!" else: if choiceshoptry == 'Y' or choiceshoptry == 'y' or choiceshoptry == 'N' or choiceshoptry == 'n': if choiceshoptry == 'y' or choiceshoptry == 'Y': orders() # print '跳转到信用卡支付页面' banklogin.bank_login() if choiceshoptry == 'n' or choiceshoptry == 'N': print '你本次确认不结算购物车内商品!%s' % time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())) #格式化输出当前时间2015-11-29 15:39:30 break else: flag += 1 print "你的输入有误,请重新输入[y/n]!" print "系统将退出购物车!" time.sleep(1)