Python 输入后的新行
我希望得到以下输出:Python 输入后的新行,python,input,output,Python,Input,Output,我希望得到以下输出: Type in something random: 2 我使用了以下代码: input("Type in something random:") 我的输出是 Type in something random:2 (用户输入“2”时的输出) 如上所示,如何在新的行中向我提供输出 我正在使用Python 3。只需在字符串末尾添加一个\n(新行字符),如下所示: input("Type in something random:\n") 只需在字符串末尾添加一个\n(新行字
Type in something random:
2
我使用了以下代码:
input("Type in something random:")
我的输出是
Type in something random:2
(用户输入“2”时的输出)
如上所示,如何在新的行中向我提供输出
我正在使用Python 3。只需在字符串末尾添加一个
\n
(新行字符),如下所示:
input("Type in something random:\n")
只需在字符串末尾添加一个
\n
(新行字符),如下所示:
input("Type in something random:\n")
尝试添加一个新行字符,如下所示
input("Type in something random: \n")
所以你会得到这样的输出
Type in something random:
6
'6'
尝试添加一个新行字符,如下所示
input("Type in something random: \n")
所以你会得到这样的输出
Type in something random:
6
'6'
尝试添加\n
print("Type in something random: \n2")
Type in something random:
2
尝试添加\n
print("Type in something random: \n2")
Type in something random:
2
输入(“输入一些随机信息:\n”)
。谢谢!我以为我以前试过,否则我就不会问了,但看起来我一定是弄错了。现在可以了。@Austin,你应该把答案作为答案而不是评论发布。input(“输入一些随机的东西:\n”)
。谢谢!我以为我以前试过,否则我就不会问了,但看起来我一定是弄错了。现在可以了。@Austin,你应该把答案作为答案而不是评论发布。