Cargo.toml
[package]
name = "rust-example5"
version = "0.1.0"
edition = "2021"
[dependencies]
peroxide = "0.31.6"
serde = { version = "1.0.133" , features = ["derive" ] }
serde_json = "1.0.75"
main.rs
#![allow(non_snake_case)]
extern crate peroxide;
use std::env;
fn main () {
let args : Vec <String > = env::args ().collect::<Vec <_>>();
println! ("{:?}" , args);
for arg in &args {
println! ("{:?}" , arg);
}
let x1 = &args[0 ];
let x2 = &args[1 ];
println! ("{:?}{:?}" , x1, x2);
}
example1.py
"""
Created on Fri Sep 2 13:36:56 2022
@author: Userss
"""
from numpy import *
import json
import os
import sys
main = r"target\release\rust-example5.exe"
params1 = r'11'
print (main+' ' +params1)
r_v = os.system(main+' ' +params1)
print (r_v )
example2.py
"""
Created on Fri Sep 2 13:36:56 2022
@author: Userss
"""
import os
import subprocess
main = r"target\release\rust-example5.exe"
if os.path.exists(main):
rc,out= subprocess.getstatusoutput(main+' ' +'111' )
print (rc)
print ("out=" ,out)
print ("type of out=" ,type (out))
example3.py
"""
Created on Fri Sep 2 13:36:56 2022
@author: Userss
"""
import os
main = r"target\release\rust-example5.exe"
f = os.popen(main+' ' +'111' )
data = f.readlines()
f.close()
print (data)
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】