基本上,在我输入之后,它会将文本打印在新行上。我希望它在用户在同一行上输入后打印文本。我不想获取输入然后再将其打印回用户,我只想拥有一个不执行任何操作但只能让用户输入内容的输入。 (我是python的新手,所以请保持简单)
这是我正在玩的一款小游戏。我尝试做input(“ Blah”,end =“”),但这只是告诉我input()不带关键字。
import time
def type(str):
for letter in str:
print(letter, end='')
time.sleep(0.02)
type("My card number is ")
input()
time.sleep(0.5)
type(" and the expiry date is ")
input()
time.sleep(0.5)
type(". Finally,")
time.sleep(0.5)
type(" the three numbers on the back are ")
input()
print(".")
我希望它最终像这样:
My card number is 1234 and the expiry date is 1234. Finally, the three
numbers on the back are 123.
相反,我得到了:
My card number is 1234
and the expiry date is 1234
. Finally, the three numbers on the back are 123
.