Search code examples
pythonvisual-studio-codepython-idle

How to use VS Code - Python Shell


So I am relatively new to programming and used to use Python's own "IDLE". After I run a ".py" file with IDLE, I am used to getting a python shell or a command window, I don't really know the terminological name for it, where I could play around with the objects inside the script.

For example, if I had a list A=[1,2,3] inside the program, after I run it I get a command console that says ">>" and I can say ">>A" which gives me "[1,2,3]" and I can add elements to A etc.

Now, I want to start using VS Code but I can't seem to find that particular thing. I have a terminal where I can run python code if I give the command "python" first, but It doesn't seem to effect anything inside the script.

I want to use that to see if some objects are working fine and to check their types etc. I add more lines to code after I try from there first, if that makes sense.

Sorry for really bad terminology, I really don't know the names but I can try even more if it's not clear.

Thanks a lot in advance.


Solution

  • Are you looking for the Integrated Terminal of VS Code?

    Here are some ways to open the terminal:

    • Use the ⌃` keyboard shortcut with the backtick character.

    • Use the View > Terminal menu command.

    • From the Command Palette (⇧⌘P), use the View: Toggle Integrated Terminal command.

    In the window that shows up, enter python and you'll get the Python shell you're looking for.