我的修改仅适用于引用的索引.如何让它适用于所选的任何索引?



我希望用户选择索引。不仅仅是在代码中分配一个。

def pending():
if selection == 'P':
(int(raw_input('Choose an item to mark pending and hit enter. ')))
mylist.append(mylist[0] + '-' + "pending")
del mylist[0]
print mylist
print ("n")
print 'What would you like to do next?'
i = 0
for list in mylist:
print (i, list)
i = i + 1
x = (int(raw_input('Choose an item to mark pending and hit enter. ')))
mylist.append(mylist[x] + '-' + "pending")

我认为这就是你需要的。如果没有,请对问题添加更多解释。

最新更新