Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send code to interactive python sublime text

How does one sent highlighted code from sublime text 2 editor to the interactive console started by going to view > show console in sublime text 2?

like image 835
user1234440 Avatar asked Jan 12 '23 07:01

user1234440


1 Answers

If you are on Sublime Text 2 for a Mac, then press 'command' + 'B' to build. If you are on Windows, then press 'Ctrl' + 'B'.

  • Make sure to save your file with a .py extension (so your system will know to build in Python)
  • Also check to make sure that your 'Tools' > 'Build System' > 'Automatic'

I hope I interpreted your question correctly. If you're trying to make an interpreter on the console, you can use 'Package Control' to install SublimeREPL (https://github.com/wuub/SublimeREPL)

Edit: Showing the key control depending on what you want (e.g. just take the selection, the line, the entire file). Screenshots are on a Windows 7 PC.

After installing SublimeREPL, go to 'EVAL in REPL', and pick your selection

Here's evaluating just one line of python code

like image 69
Will Avatar answered Jan 13 '23 21:01

Will