i= int(input("how many iteration : ")) #input value of i
all_lists = [] #this will store your all lists
for j in range(i): #loop from 0 to i
temp_list = [] #this will hold the temporary lists
n = int(input("number of inputs : ")) #how many inputs will be in each list
for k in range(n):
value = input()
temp_list.append(value) #insert the values to temporary list
all_lists.append(temp_list) #insert the temporary list to your main list
print(all_lists)
i
是一个变量在这里。所以呢你不知道你需要多少lists
。这取决于用户的输入。所以你可以用另一个list
(而不是list A
,list B
,…)来保存另一个名单。你呢可以这样做:相关问题 更多 >
编程相关推荐