简体   繁体   English

Sublime Text 3中的Python无法对简单操作做出响应

[英]Python in Sublime Text 3 won't respond on simple operations

My editor Sublime Text 3 don't respond on code like: 2+2 我的编辑器Sublime Text 3对以下代码没有响应: 2+2

Here is the case 就是这种情况 在此处输入图片说明

Every other code like: print("Hello World") , works perfectly. 其他所有代码,例如: print("Hello World") ,都可以正常工作。 Is there any solution or I need to change editor? 有什么解决方法还是我需要更换编辑器?

I just didn't display on console. 我只是没有在控制台上显示。 You can use print(2+2) to print out the result 您可以使用print(2+2)打印结果

This is normal behaviour. 这是正常的行为。 When running a script file, you have to use print to display any outputs. 运行脚本文件时,必须使用print来显示所有输出。 For example: 例如:

x = 2 + 2
print(x)

my editor Sublime Text 3 don't respond on code like: 2+2 我的编辑器Sublime Text 3对以下代码没有响应:2 + 2

If you want this behaviour you need to fire up a python interpreter. 如果您想要这种行为,则需要启动一个python解释器。 Sublime Text 3 does not interpret your code. Sublime Text 3不会解释您的代码。 It just executes your scripts. 它只是执行您的脚本。

If you want to display output, you'll need to print it. 如果要显示输出,则需要print它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM