[英]How do I make it so my code can return to a line if the User says No
textinfo = str(input("Insert Text here:"))
LocateInText = str(input("Insert What needs to be found (i.e words, numbers, ect):"))
Confrim = str(input("Are you sure? This may take a bit, Y or N:"))
if Confrim == "N":
find: LocateInText
I am trying to make it so that when the user says N (no) It repeats LocateInText to correct themselves我正在努力做到这一点,以便当用户说 N(否)时,它会重复 LocateInText 来纠正自己
If the textinfo does not need to be edited you can add the LocateInText and Confirm into a while loop and break it when user confirms it.如果不需要编辑文本信息,您可以将 LocateInText 和 Confirm 添加到 while 循环中,并在用户确认时将其中断。
textinfo = str(input("Insert Text here:"))
while True:
LocateInText = str(input("Insert What needs to be found"))
Confrim = str(input("Are you sure? This may take a bit, Y or N:"))
if Confirm == 'Y':
break
# do next thing here
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.