平台:Git bash MINGW64,Windows 7,64 CMD当我从Learn Python Hard Way ex11运行Python代码时.代码很简单.
print "How old are you?",
age = raw_input()
print "How tall are you?",
height = raw_input()
print "How much do you weigh?",
weight = raw_input()
print "So, you're %r old, %r tall and %r heavy." % (
age, height, weight)
Run Code Online (Sandbox Code Playgroud)
但是他们在CMD和Git bash中有不同的结果.当我使用Git bash运行它时,raw_print()将首先运行.
当您输入3个答案时,它将在最后显示4个打印件.当我在CMD中运行时,它通常显示一个打印,一个raw_input()
.
有人可以解释一下吗?
编辑:实际上,我的目标是解释原因,而不是用flush来解决这个问题.所以与这个问题不同