【问题标题】:Write Python output to file using makefile使用 makefile 将 Python 输出写入文件
【发布时间】:2012-12-07 03:13:05
【问题描述】:

我有一个 Python 程序 prog.py,我想在文件 input 上运行它,然后将其输出写入 output.txt

在终端中,如果我输入以下内容就可以正常工作:

$ python prog.py < input.py > output.txt

现在,我想要一个做同样事情的 makefile。我该怎么做?

【问题讨论】:

  • 您可以将python prog.py &lt; input.py &gt; output.txt 放在run.sh 文件中并通过您的Makefile 调用它。

标签: python makefile output file-io


【解决方案1】:

在您的 makefile 中只需:

all:
    python prog.py < input.py > output.txt

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-04
    • 1970-01-01
    • 2016-03-18
    • 2019-10-12
    • 1970-01-01
    • 2016-05-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多