简体   繁体   English

从Python到EXE的价值传递

[英]Value Pass from Python to EXE

Actually I create ".exe" file using C++ that takes 1 value as input and calculate the result. 实际上,我使用C ++创建了“ .exe”文件,该文件以1值作为输入并计算结果。 Now i want to pass the value form a python program to the ".exe" directly. 现在,我想将值从python程序直接传递给“ .exe”。 Is is actually possible?? 真的有可能吗?

One thing you can do is output the python program to a file. 您可以做的一件事是将python程序输出到文件。 From the console it looks like: 从控制台看起来像:

$ python script.py > output

or you can do it in Python by redirecting stdout to file: 或者您可以在Python中通过将stdout重定向到文件来实现:

import sys
sys.stdout = open('output', 'w')

Then you can use the output file as input to your exe. 然后,您可以将输出文件用作exe的输入。

$ program.exe output

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM