我尝试将字符串作为命令行参数发送到我的python脚本,如下所示:
var cmdToBeExecute = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\myScript.py";
var start = new ProcessStartInfo
{
FileName = "C:\\Python27\\python.exe",
Arguments = string.Format("{0} {1}", cmdToBeExecute, "Rahul done good"),
UseShellExecute = false,
RedirectStandardOutput = true,
CreateNoWindow = true
};
Run Code Online (Sandbox Code Playgroud)
我试着读取命令行参数并在python中显示为:
import sys
print sys.argv[1]
Run Code Online (Sandbox Code Playgroud)
但是,我只得到第一个单词"Rahul"作为输出.请帮我把string作为命令参数参数发送到我的python脚本.
c# python processstartinfo command-line-arguments python-2.7