I am new to python and learning using the vs code editor. I noticed that every time i run a command, all my previous commands are printed together with the new command on the terminal box. how do I stop this and have only the new command print at a time
Do you use that VSCode’s extension code runner ? if yes than go to settings and search for code runner: Clear previous Output (enable it) and then disable Code Runner: Show run command. This commands will clear console that you will see just output of code it will clear everything else.Hope I helped.
could you attach a screenshot for better understanding of the issue?
I had disabled my code runner initially. Therefore not using it.
Thanks for the comment
See attached. I have highlighted the commands printed on the terminal box as 1,2,3 to explain the repetition of scripts, every time a new command is executed.
I see you are on Mac, and you seem to be executing your script within a shell of Python instead of a bash shell (or whatever the MacOS shell is, might be zsh?)
Things function in different ways when you use the python shell than how they do on bash or zsh (in my Windows machine CMD or Powershell).
Can you try to close the three terminals that are open (see my picture) and open a new terminal with Menu: “Terminal”, Option: “New Terminal”?
Then you should find a command line with the usual prompt, and commands like:
should work as expected printing:
I love mangoes
just once, without the whole path to the python interpreter and the file.
Hope this helps.