我想为此添加一个循环:
question = raw_input("Reboot Y/N ")
if len(question) > 0 and question.isalpha():
answer = question.upper()
if answer == "Y":
print "Reboot"
elif answer == "N":
print "Reboot Cancled"
else:
print "/ERROR/"
Run Code Online (Sandbox Code Playgroud)
因此,如果用户输入任何其他内容,则会出现错误并将其发送回问题.