Search code examples
pythonsublimetext3

Output without "print()" in SublimeText


Is there a way/plug-in to enable output without "print()" in SublimeText?

For example,

a = 1 + 2
print (a)

Output:

3

Wanted:

a = 1 + 2
a

Output:

3

P.s. I also tried below:

enter image description here

enter image description here


Solution

  • I am pretty sure that the answer is no. You can rename the print function to make it less noticable like this:

    _ = print
    
    a = 2
    
    _(a)
    

    Output is 2

    Alternatively:

    As a few people mentioned in the comments, what you are likely looking for is a repl, which you can get by simply running python command directly in your terminal.

    like this:

    $ python
    

    that should take you to an interactive environment that gives you real time results for the python code you input. Below is an example...

    >>> a = 1 + 2
    >>> a
    3
    >>> a + 25
    28
    >>> a
    3
    >>> a = a + 25
    >>> a
    28