I want to get user input for multiple times and store the input data together in a string until input "quit" to quit from input. I think a for loop can work but I don't know how to do it.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
while True:
user_input = raw_input("Enter something:")
if user_input == "quit":
break
回答2:
Try this:
input_string = ''
while 1:
input = raw_input('Add to string: ')
if input == 'quit': break
input_string += input
回答3:
while True:
input = raw_input('Prompt')
print input
if (input == 'quit'):
break;