您的位置:首页 > 编程语言 > Python开发

C# 调用批python 脚本

2007-07-27 15:00 459 查看
1.加命名空间


using System.Diagnostics;

2.实现例子


try




...{


string myDocumentsPath = AppDomain.CurrentDomain.RelativeSearchPath;


myProcess.StartInfo.FileName =myDocumentsPath+ /views.py; //指定python文件


myProcess.StartInfo.Arguments = picname + " " + style; //带参数


myProcess.StartInfo.CreateNoWindow =true;


myProcess.StartInfo.UseShellExecute = false;


myProcess.Start(); //启动


//


myProcess.WaitForExit();




// Label1.Text = "Python script is successfully executed!";




}


catch (Exception er)




...{


Label1.Text = er.ToString();


}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: