簡體   English   中英

我如何使輸入的行低於打印的行?

[英]How do i make input's line be below the printed line?

這就是我所擁有的:

choice = int(input("Choose an action")) - 1

在控制台中,它看起來像這樣:

Choose an action(The user input goes here)

我想要的是:

Choose an action
(the user input goes here)

您可以打印消息,這將自動添加換行符:

print("Choose an action")
choice = int(input()) - 1

或在輸入消息的末尾手動添加換行符( \\n ):

choice = int(input("Choose an action\n")) - 1

做就是了 :

print("Choose an action")
choice = int(input()) - 1

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM