Python 3.9关于输入功能的怪异行为
我在最新的Pycharm IDE中使用Python 3.9。我有一个非常简单的3衬里:
a=input()
b=input()
print(b)
我输入3,然后输入4 ---但是,以某种方式未注册该值4,什么也没有打印。奇怪的是,当我在第二个输入函数中添加提示时,一切都返回正常,
a=input()
b=input("test:")
print(b)
输出将按预期返回值b。我到处都在网上看,无法解释这种奇怪的行为。到底是怎么回事?
I am using python 3.9 in the newest Pycharm ide. I have a very simple 3 liner:
a=input()
b=input()
print(b)
I input 3, enter, then 4---but somehow the value 4 is not registered, and nothing is printed. Strangely enough, when I add a prompt to the second input function, everything returns normal
a=input()
b=input("test:")
print(b)
The output returns the value b as expected. I have looked everywhere online and could not explain this odd behaviour. What is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
原来是一种pycharm设置。必须在运行/编辑配置下启用“在输出控制台中模拟终端”
Turns out to be a pycharm setting. Had to enable "emulate terminal in output console" under run/edit configurations