python - 如何使输入行低于打印行?

标签 python

这是我的:

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

关于python - 如何使输入行低于打印行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46279794/

相关文章:

python - 在 Windows 上使用 pip install MySQL-python 安装 MySQL 不起作用?

python - Pandas 添加所有值为零的行

Python 类次调度优化

java - 跨 Java 和 Python 的 PKI 验证

python - 网络驱动程序异常 : Message: 'chromedriver' executable needs to be in PATH while setting UserAgent through Selenium Chromedriver python

python redis hget 字符串转字典

Python/Pandas UPSERT 等效项?

python - 如何处理 PEG 语法中的负数?

javascript - JavaScript 中的 Python Pandas 等价物

python - "Not implemented"使用pywin32控制Adobe Acrobat时出现异常