我想回到“我的生活”;输入“;在python中键入错误字符后
我想在用户键入另一个不是“n”字符串的字符后返回“input”, 输入数据是一个“输入”,它使用户按enter键继续或键入“n”,但如果用户键入另一个字符串,控制台将关闭我想回到“我的生活”;输入“;在python中键入错误字符后,python,if-statement,input,Python,If Statement,Input,我想在用户键入另一个不是“n”字符串的字符后返回“input”, 输入数据是一个“输入”,它使用户按enter键继续或键入“n”,但如果用户键入另一个字符串,控制台将关闭 您可以使用while循环: >>> user_input = '' >>> while user_input != 'n': ... user_input = input("Enter your input: ") ... Enter your input: a
您可以使用while循环:
>>> user_input = ''
>>> while user_input != 'n':
... user_input = input("Enter your input: ")
...
Enter your input: a
Enter your input: 1
Enter your input: 3
Enter your input: n
>>>
您应该使用这样的while循环来完成
_WriteList = input("Write a textfile with the file list? (Enter) Yes or (n) No: ")
while _WriteList != 'n':
sevenZipListWrite()
_WriteList = input("Write a textfile with the file list? (Enter) Yes or (n) No: ")
sevenZipList()
请在下一次发布之前尝试做一些研究。
_WriteList = input("Write a textfile with the file list? (Enter) Yes or (n) No: ")
while _WriteList != 'n':
sevenZipListWrite()
_WriteList = input("Write a textfile with the file list? (Enter) Yes or (n) No: ")
sevenZipList()