0

Each time i run a print command in Visual Studio Code i get a ">>>" and an echo of my print command!, how can i stop this?, here is a image :
My Code:

print("hello world")  

Result :
enter image description here

2
  • @kabanus I simply want the console shows a single string "hello world" i do not need the ">>> print("hello world") Commented Nov 14, 2018 at 20:46
  • I got that now, thanks. I am guessing the other commands are not echoed, only print? Commented Nov 14, 2018 at 20:47

1 Answer 1

2

It looks like you're running the print statement from the python interpreter, which means that when you run a line it will print the line, then (if applicable) the output the line produces.

If you're trying to use the print statement within a python script, you should install the python extension for Visual Studio Code, and use it to run the file containing your script.

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

5 Comments

I have used the "select interpreter" and i selected "Anaconda" as my interpretor, is this the reason for the echo ?, can i stop this?
How are you running the print command? Is it part of a file, or are you typing it into a prompt?
i looked for the simplest method to run the code, and i reached shift + enter, meaning i select all the codes and use shift + enter
The documentation for the python VSCode extension says to "Select one or more lines, then press Shift+Enter or right-click and select Run Selection/Line in Python Terminal. This command is very convenient for testing just a part of a file.". If you run in the python terminal it will echo (print) each line before executing. If you don't want this you should run the entire file with right click -> run python file in terminal
thanks to you i found the problem, it was indeed because i was running the code using "Shift + Enter" and not using "Run the python file in terminal"

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.