input("Hi I'm new to python")
userInput = input("Enter a string")
print(f"You entered {userInput}")
在控制台中,它显示来自输入的字符串(“字符串”),但任何用户击键都会在代码编辑器中键入,而不是以交互方式键入
我读到Python不能通过这些应用程序进行交互,但我不知道如何执行语法正确的“输入”(“输入你最喜欢的寿司卷”)并与之交互(在pc和Mac上)
从控制台:
Enter a string
Traceback (most recent call last):
File "/Users/michaelking/Desktop/BBEditRunTemp-hellowWorld.py", line 1, in userInput = input("Enter a string")
EOFError: EOF when reading a line
================================================================================ Nov 2, 2020 at 9:53:07 PM ~/Desktop/hellowWorld.py Traceback (most recent call last): File "/Users/michaelking/Desktop/BBEditRunTemp-hellowWorld.py", line 1, in userInput = input() EOFError: EOF when reading a line
当您运行一个需要交互式输入的脚本时,您必须在终端(或类似于iTerm的终端)中运行它
我无法与其他产品交流:-)但是当使用BBEdit时,#上的“Run-in-Terminal”命令!菜单会帮你的
相关问题 更多 >
编程相关推荐