Display Python Output in Sublime text [duplicate]

北城余情 提交于 2020-01-02 02:32:25

问题


New to Python & Sublime

Problem: I type 'print ("Hello world")

How do I get it to show me the output (Hello world), is it in a separate window? or...

I understand I can use the Python Console built in, but that's a command line, what about when I get to use a ton of code, how do I get the output?


回答1:


Click on tools > build systems > select Python, then Build with using ctr+shif B and select python, and it ll work. Second time you can use the build command, ctr + B since python is now set as default




回答2:


My Sublime Extras extension, and MiniPy, the extension I stole it from, both allow this. Search "eval" on the Extras Github page or use MiniPy.

Maybe SublimeREPL, too, depending in what you are after.




回答3:


Press CtrlB

Alternatively, if you're on linux or mac, save the file as hello.py in your home directory and do the following in a terminal / command line:

$ cat hello.py
print("Hello World")
$ python3 hello.py
Hello World

If you're on Windows you're best off using the built-in functionality of sublime.



来源:https://stackoverflow.com/questions/20832826/display-python-output-in-sublime-text

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!