【发布时间】:2011-02-01 14:09:42
【问题描述】:
嘿嘿,我刚刚做了以下事情:
a = input("give a word: ")
b = input("give another word: ")
c = a + " " + b
print("result is", c)
并得到如下输出:
give a word: name
give another word: word
result is name
word
我的问题是为什么 pydev 或 eclipse 控制台上的输出分两行?我希望输出如下:
give a word: name
give another word: word
result is name word
这是怎么发生的,为什么发生在我身上?在 cmd 上看起来不错??!!
我还发现 python 使用“\r”保存字符串,我认为这是在 pydev 控制台上出现此问题的原因,是吗?
【问题讨论】:
-
哟,结果就是名字,兄弟!字!
-
什么?,我没听懂你在说什么
-
没关系。您可以/应该使用
raw_input而不是input。它不那么可怕,因为它没有eval。 -
@Thomas:在 Python-3.x 中,
input就像在 Python-2.x 中的raw_input一样。 (raw_input更名为input)。 -
恐怕python 3.1没有名为“raw_input”的函数
标签: python python-3.x pydev eclipse-3.5