When I am running a python program for example :
print("hello world")
I get too many texts in the terminal (VS Code)
Windows PowerShell
Copyright (C) 2015 Microsoft Corporation. All rights reserved.
PS C:UsersDimuth De ZoysaDesktopPython_projects> & "C:/Users/Dimuth De Zoysa/AppData/Local/Programs/Python/Python38/python.exe" "c:/Users/Dimuth De Zoysa/Desktop/Python_projects/main.py"
hello world
PS C:UsersDimuth De ZoysaDesktopPython_projects>
But I really wanted is something like this :
hello world
So, How can I remove those paths & nonsense text ?
2
Answers
Try following which will skip the first two lines and then print lines that do not start with a PS
First of all, they are not meaningless text, they show the execution command of the script file, which can also ensure that the script can be executed normally in any directory. We should get used to the way it works.
If you must get clean output, install the Code Runner extension, add the following to the settings.json, and execute the script with
Run COde
If there is no special need, please do not use Code Runner. Using Python extensions is the best way.