Python stdin请求在stdout打印之前到达
我最近一直在尝试学习Python3.3,但遇到了一个问题。以下是我正在使用的测试代码:Python stdin请求在stdout打印之前到达,python,printing,stdin,raw-input,Python,Printing,Stdin,Raw Input,我最近一直在尝试学习Python3.3,但遇到了一个问题。以下是我正在使用的测试代码: print('should print before stdin') x = raw_input('Enter something: ') 以下是输出结果: >>something should print before stdin Enter something: 为什么打印语句出现在stdin之后?在Python3.X中,原始输入(“”)已被删除,因此使用input()。 参考这个 输出
print('should print before stdin')
x = raw_input('Enter something: ')
以下是输出结果:
>>something
should print before stdin
Enter something:
为什么打印语句出现在stdin之后?在Python3.X中,原始输入(“”)已被删除,因此使用
input()
。
参考这个
输出
should print before stdin
Enter something: yes
Process finished with exit code 0
嗯,“>>”上面说了很多事情。试着不要在空闲状态下运行它。关闭idle并双击.py文件,看看是否有效。如果这只是您正在运行的代码,那么它应该可以正常运行。。至少在python上<3.0
should print before stdin
Enter something: yes
Process finished with exit code 0