Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (12.7k points)

Can anyone tell me how to execute the python code from within the visual studio code?

1 Answer

0 votes
by (26.4k points)

Here is the means by which to arrange Task Runner in Visual Studio Code to run a .py file. 

In your support, press Ctrl + Shift + P (Windows) or Cmd + Shift + P (Apple). This raises an inquiry box where you look for "Configure Task Runner" 

On the off chance that this is the first occasion when you open the "Task: Configure Task Runner", you need to choose "other" at the lower part of the following choice rundown.

This will raise the properties which you would then be able to change to suit your inclination. For this situation, you need to change the accompanying properties; 

  1. Change the Command property from "tsc" (TypeScript) to "Python"
  2. Change showOutput from "silent" to "Always"
  3. Change args (Arguments) from ["Helloworld.ts"] to ["${file}"] (filename)
  4. Delete the last property problemMatcher
  5. Save the changes made

You would now be able to open your .py record and run it pleasantly with the alternate route Ctrl + Shift + B (Windows) or Cmd + Shift + B (Apple).

Want to learn python to get expertise in the concepts of python? Join python certification course and get certified

Browse Categories

...