0

I'm writing code in Python and using both the default IDLE and Visual Studio Code as my development environments. I was wondering if there is a interactive shell like the one in IDLE in vscode, where I can run code and then enter the variable name to find out its value. I've been having trouble finding a shell-like feature in VSCode, similar to IDLE's shell. Is there any way to use IDLE's shell functionality within VSCode?

I tried using the terminal to set up a simple interactive interpreter, but I encountered an error. Is the terminal not suitable for using as an interactive interpreter?

2
  • 3
    The interactive shell is a feature of python not the editor. Run python in the terminal in vscode and you enter the interactive shell. Commented Jul 30, 2023 at 15:35
  • Does this answer your question? How do I open the interactive shell/REPL in Visual Studio Code? Commented Jul 30, 2023 at 16:38

3 Answers 3

1

Open a new terminal in vscode Ctrl + Shift + `

Run the python command

Then you have an interactive python shell

Python 3.11.3 (main, Jun  5 2023, 09:32:32) [GCC 13.1.1 20230429] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Note: keybindings might differ on mac.

Sign up to request clarification or add additional context in comments.

3 Comments

When I run Python code with f5, it's debugging so it runs on the Python Debug Console, how do I run it on the specified Python Terminal? I'm sorry in advance, I'm very new to this.
Keybindings. f5 is debug. ctrl+f5 or alt+x should be to run a python file, but it might not be set in your keybindings. Open default keybindings: Command Palette > Preferences: Open Default Keyboard Shortcuts (JSON), search for the keybinding you want, use google to find the specific name. To edit or change your keybindings, open user keybindings: Command Palette > Preferences: Open Keyboard Shortcuts (JSON), and add your keybbindings there. code.visualstudio.com/docs/getstarted/keybindings
example: "key": "alt+x", "command": "python.execInTerminal-icon"
1

Use the interactive window:

enter image description here

https://code.visualstudio.com/docs/python/jupyter-support-py

You can also use the shortcut key Shift+Enter to open an interactive terminal:

enter image description here

Comments

0

Python Interactive window is a nice mix between Jupyter and IDLE

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.