[英]Python stdin request coming before stdout prints
I've been trying to learn Python 3.3 recently and run into a problem. 我最近一直在尝试学习Python 3.3并遇到问题。 Here is the test code I am using:
这是我正在使用的测试代码:
print('should print before stdin')
x = raw_input('Enter something: ')
And here is what the output looks like: 这是输出的样子:
>>something
should print before stdin
Enter something:
Why are the print statements coming after the stdin? 为什么打印语句在标准输入之后?
In Python 3.X, the raw_input("")
has been eliminated and so use input()
instead. 在Python 3.X中,已删除了
raw_input("")
,因此请使用input()
。 Refer this docs . 请参阅此文档 。
print('should print before stdin')
x = input('Enter something: ')
Output 产量
should print before stdin
Enter something: yes
Process finished with exit code 0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.