7

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?

Veedrac
  • 58,273
  • 15
  • 112
  • 169
user3144985
  • 89
  • 1
  • 1
  • 2
  • What OS are you using? Do you prefer running / viewing output from sublime or from the command line? – cronburg Dec 30 '13 at 03:27
  • 1
    This question is specifically about displaying the output of the python code in the build results window. Super+Shift+B is the right answer. It is not a duplicate of the other question, but an extension of it. – pheon Feb 12 '17 at 17:35
  • 1
    @pheon - Agreed. Another way is to go to `Tools--> Build Results --> Show Build Results`. – BruceWayne Jan 22 '18 at 15:40

3 Answers3

8

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

user235913
  • 81
  • 1
  • 2
0

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.

Andreas Haferburg
  • 5,189
  • 3
  • 37
  • 63
cronburg
  • 892
  • 1
  • 8
  • 24
0

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.

Veedrac
  • 58,273
  • 15
  • 112
  • 169