python中调用C++可执行文件并传入参数

python代码:

import os
main = r"D:\c++_code\Parser\bin\Debug\Parser.exe" #c++生成的exe文件执行位置
os.system(main +' ' +input_file+' '+out_file) #调用os.sysytem函数,函数以空格隔开这里参数为input_file,out_file

C++代码

int main(int argc,char* argv[]){
    for(int x = 0;x< argc;x++){
        cout<< "the send parameter"<

 

你可能感兴趣的:(python)