在 Prolog 程序中调用 Python 文件
Calling Python file in Prolog Program
我想在序言代码中使用 python 文件。我想将 prolog 中生成的文本传递到 python.How 的 text_to_speech_converter 中,我可以这样做吗?我更喜欢只保留prolog的界面。
一种选择是使用 shell/2
来自 http://www.swi-prolog.org/pldoc/man?predicate=shell/2
?- shell('cmd.exe /C copy file1.txt file2.txt').
然后您的 python 脚本应该像往常一样从 shell
调用
?- shell('cmd.exe /C python hello.py > out.txt').
我想在序言代码中使用 python 文件。我想将 prolog 中生成的文本传递到 python.How 的 text_to_speech_converter 中,我可以这样做吗?我更喜欢只保留prolog的界面。
一种选择是使用 shell/2
来自 http://www.swi-prolog.org/pldoc/man?predicate=shell/2
?- shell('cmd.exe /C copy file1.txt file2.txt').
然后您的 python 脚本应该像往常一样从 shell
调用?- shell('cmd.exe /C python hello.py > out.txt').