我刚刚用 C# 编写了一个大小合适的疾病传播模型.但是,我对 .NET 还很陌生,不确定如何继续.目前我只是双击 .exe 文件,模型从文本文件中导入配置设置,执行它的操作,并将结果输出到文本文件中.
I've just about finished coding a decently sized disease transmission model in C#. However, I'm fairly new to .NET and am unsure how to proceed. Currently I just double-click on the .exe file and the model imports config setting from text files, does its thing, and outputs the results into a text file.
接下来我想做的是编写一个 Python 脚本来执行以下操作:
What I would like to do next is write a Python script to do the following:
迄今为止,我的大部分编程经验都是在 Linux 上使用 C/C++.我对最后两项相当有信心;但是,我不知道如何进行前两个.以下是一些我想提出建议的具体问题:
The majority of my programming experience to date has been in C/C++ on linux. I'm fairly confident about the last two items; however, I have no idea how to proceed for the first two. Here are some specific questions I'd like advice on:
谢谢!
从 Python 2.6+ 开始,您应该使用 subprocess
模块:(文档)
As of Python 2.6+ you should be using the subprocess
module: (Docs)
import subprocess
for v in range(1000):
cmdLine = r"c:path omyapp.exe"
subprocess.Popen(subprocess)
subprocess.Popen(r"move output.txt ./acc/output-%d.txt" % (v))
这篇关于从 python 脚本运行 C# 应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!