赞
踩
我目前正在开发一个处理用户输入的程序,我遇到了一个情况,在一个input()下需要多个返回,一开始我不知道当我得到一个值错误时我在做什么,直到我查了怎么做,它向我展示了这一点,并且在使用input().split()的两个输入时运行良好class userinput():
def __init__(self, name,lista,listb,listc,listd):
self.name=""
self.lista=lista
self.listb=listb
self.listc=listc
self.listd=listd
def set_lists(self):
print("Do you want to create lists")
decision = input()
if decision == "yes":
print("how many lists would you like to create?(up to 4)")
decision2= int(input())
if decision2 == 1:
print("what would you like the list to be named")
self.lista=input()
print("you have created 1 list, with the name:"+ self.lista)
elif decision2 == 2:
print("what would you like yo
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。