让一个 Python 程序“喂食”另一个
我正在尝试做一些关于 2-SAT 和 3-SAT 的作业,我被允许在网上搜索该程序的实施情况。我遇到了 2 个 Python 程序,基本上我可以运行它们,它们使我能够继续我的作业。但是,我无法从一个程序获取输出来提供另一个程序:
此处的代码: http://goo.gl/ 6fdlq 应为此处的代码提供输入:http://goo.gl/rdfyR 说明是这样说的:
Python 中的问题生成器 - 生成 C 语法表达式 或输入...功能齐全 Python 中的 GSAT 求解器 - 接受输入 从上述并试图满足 它,同时生成日志 输出旨在指导 那些不熟悉 GSAT 的人 算法。
任何人都可以告诉我该怎么做吗?
I am trying to do some work on 2-SAT and 3-SAT for an assignment and I was allowed to search the web for the implementation of the program. I came across 2 programs in Python that basically I can run and they enable me to continue with my assignment. However I can't get the output from one program to feed the other one:
The code here: http://goo.gl/6fdlq should provide input for the code here: http://goo.gl/rdfyR
which is what the instructions say:
Problem generator in Python -
Generates either C syntax expressions
or the input to... Fully functional
GSAT solver in Python - takes input
from the above and attempts to satisfy
it, while generating a log of the
output intended to be instructional to
those unfamiliar with the GSAT
algorithm.
Anyone could please tell me how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要做的是将第一个脚本的输出通过管道传输到第二个脚本中。
由于这些脚本似乎分别命名为
3sat.py
和gsat.py
,只需cd
进入它们所在的目录并运行:或者,等效地:
What you want to do is pipe the output from the first script into the second.
Since the scripts seem to be named
3sat.py
andgsat.py
respectively, justcd
into the directory where they're located and run:or, equivalently: