[英]Python input function keeps on taking input even after EOF?
I just started learning python and am facing an error, i don't know how to resolve. 我刚刚开始学习python,并且遇到错误,我不知道如何解决。 I just wrote a code which simply asks the user to enter a number,using input function.
我只是编写了一个代码,该代码仅要求用户使用输入功能输入数字。
a=input("enter the number:")
print("The number you entered:")
print(a)
and the output for this is 的输出是
enter the number:101
4645
65465464564654654
54545445
enter image description here 在此处输入图片说明
It just doesn't go to print statement, it keeps on taking the input for variable a. 它只是不执行print语句,而是继续获取变量a的输入。 Please help... I am using pycharm to write the code.
请帮助...我正在用pycharm编写代码。
Not sure if I got your question right but you can try writing: 不知道我是否正确回答了您的问题,但是您可以尝试编写:
a = input("enter the number:")
print ("The number you entered:" , a)
and running it in shell. 并在shell中运行它。 You'll be able to get the output:
您将能够获得输出:
enter the number:101
The number you entered: 101
Hope this helps! 希望这可以帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.