【发布时间】:2019-11-30 22:03:33
【问题描述】:
我不知道如何处理一遍又一遍地执行的代码。我想实现这样的目标: (代表输出)
message=input()
print('Write down the text.')
>Write down the text.
<qwerty
>qwerty
>Write down the text.
<asd
>asd
【问题讨论】:
标签: python if-statement
我不知道如何处理一遍又一遍地执行的代码。我想实现这样的目标: (代表输出)
message=input()
print('Write down the text.')
>Write down the text.
<qwerty
>qwerty
>Write down the text.
<asd
>asd
【问题讨论】:
标签: python if-statement
你可以用
while True:
// code you want to execute repeatedly here
while 循环将继续执行,直到条件变为 false(在这种情况下永远不会),因此如果/当您想跳出循环时,您需要使用 break 语句
【讨论】:
你的意思是这样吗?
while True:
message=input("Write down the text: ")
print(message)
【讨论】: