问题
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