我最近一直在努力学习Python 3.3并遇到问题。这是我正在使用的测试代码:
print('should print before stdin')
x = raw_input('Enter something: ')
以下是输出结果:
>>something
should print before stdin
Enter something:
为什么打印语句会出现在stdin之后?
答案 0 :(得分:0)
在Python 3.X中,raw_input("")
已被删除,因此请使用input()
。
请参阅此docs。
print('should print before stdin')
x = input('Enter something: ')
<强>输出强>
should print before stdin
Enter something: yes
Process finished with exit code 0