In order to remove file path displayed in Terminal of VsCode I use
print("33c")
at the first line of each of my Python script files. Is it possible to make this line be the first line of each Python script file by default?
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
2
Answers
Here is how I solved the issue:
I needed to install Anaconda in my PC for Machine Learning purposes. After spending some times on writing python scripts on spyder and Jupyter Notebook, I hadn't any issue in program running. So I choose spyder over VsCode.
You can do even better (somewhat opinionated whether this is really better) using the
PYTHONSTARTUP
environment variable:If you’re using a
launch.json
file to define debugging profiles, then you can probably use theenv
field to definePYTHONSTARTUP
to point to a file that you define in your workspace that contains that line, like"env": "${workspaceFolder}/path/to/startup.py"
.Also, your choice of
ESC c
is a bit overkill I think. Do you really want to trigger a Full reset to initial terminal state when running any of your scripts? There are better solutions to hide a file path that gets printed by VS Code like simply clearing the screen, which you can do withCSI 2 J
orCSI 3 J
(2
means clear entire screen, and3
means to clear entire screen and wipe the scrollback buffer).