python input().split()

您所在的位置:网站首页 inputsplit函数 python input().split()

python input().split()

2023-07-30 00:31| 来源: 网络整理| 查看: 265

我目前正在开发一个处理用户输入的程序,我遇到了一个情况,在一个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 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3