Introduction

The Python Tools for Visual Studio extension is completely free. Python Tools supports different kinds of Visual Studio editions like:
Features
Install Process
Step 1 Python Tools
Step 2 Install an interpreter
Visual Studio
Python has different kinds of interpreters. They are
All installation processes are over and now we can develop Python applications in our visual studio
Step 3
Create a C# project and write the following code.
Create new project=>Click python application.
Visual Studio
Add the below code to your application.
  1. namespace WindowsFormsApplication1 {
  2. public partial class Form1: Form {
  3. public Form1() {
  4. InitializeComponent();
  5. }
  6. private void button1_Click(object sender, EventArgs e) {
  7. run_cmd();
  8. }
  9. private void run_cmd() {
  10. string fileName = @ "C:\sample_script.py";
  11. Process p = new Process();
  12. p.StartInfo = new ProcessStartInfo(@ "C:\Python27\python.exe", fileName) {
  13. RedirectStandardOutput = true,
  14. UseShellExecute = false,
  15. CreateNoWindow = true
  16. };
  17. p.Start();
  18. string output = p.StandardOutput.ReadToEnd();
  19. p.WaitForExit();
  20. Console.WriteLine(output);
  21. Console.ReadLine();
  22. }
  23. }
  24. }
Python sample_script
  1. print "Python C# Test"
Output
We will see the 'Python C# Test' in our console of C#.