Home > Software engineering >  How do I edit my VS Code environment so that I can preset Input data for my Python Code so that I do
How do I edit my VS Code environment so that I can preset Input data for my Python Code so that I do

Time:07-21

I want to ask that how can we make our VS Code workspace such that we can preset all the input we want to give to our python program at once and it uses that data when it runs in the terminal.

Like if I am working on a program and it takes multiple lines of input to reach to a part I am testing, I don't want to sit there and enter all the input data required by myself each time I change something and want to test my program and want that I can fix the inputs the program will take once I run the program.

For reference, I want to create my VS Code like the Code Chef Practice Workspace where we can write the program and preset the inputs in a box and each time we run the program, It automatically uses the input data and we don't have to type it in.

So If anyone knows any extension or method to make VS Code work like that, please help me by providing the solutions.

CodePudding user response:

Put the data into file and use the Terminal: YourProgram.py < input.txt

CodePudding user response:

You can do that in VSCode by editing the launch.json configuration file for python. https://go.microsoft.com/fwlink/?linkid=830387

  • Related