当前位置:网站首页>XII Golang others
XII Golang others
2022-07-04 05:24:00 【Willing to ride the long wind and break thousands of miles of w】
1. Execute the script
as follows golang It can be executed python Script
package main
import (
"fmt"
"os/exec"
)
func main() {
cmd := exec.Command("/usr/local/bin/python3.9", "/Users/haha/GolandProjects/awesomeProject5/test.py")
// The error output and standard output of the command are connected to the same pipe
stdout, err := cmd.StdoutPipe()
cmd.Stderr = cmd.Stdout
if err != nil {
return
}
err = cmd.Start()
if err != nil {
return
}
// Get the output from the pipeline in real time and print it to the terminal
for {
tmp := make([]byte, 1024)
_, err := stdout.Read(tmp)
fmt.Print(string(tmp))
if err != nil {
break
}
}
if err = cmd.Wait(); err != nil {
return
}
}
python The script is as follows :
#!usr/bin/python3
assert 3 == 4Execution results :
Traceback (most recent call last):
File "/Users/haha/GolandProjects/awesomeProject5/test.py", line 2, in <module>
assert 3 == 4
AssertionError
err = exit status 1边栏推荐
- With the advent of the IP era, how can E-sports hotels take advantage of the "east wind" of games?
- Notepad++ -- display related configurations
- 2022G2电站锅炉司炉特种作业证考试题库及答案
- [matlab] communication signal modulation general function - low pass filter
- KMP match string
- Electronic components mall and data manual download website summary
- Fault analysis | mongodb 5.0 reports an error, and the legal instruction solves it
- LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
- [paper summary] zero shot semantic segmentation
- Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
猜你喜欢

LM小型可编程控制器软件(基于CoDeSys)笔记二十一:错误3703

LabVIEW错误对话框的出现

Etcd database source code analysis - initialization overview

Capturing and sorting out external Fiddler -- Conversation bar and filter

Simulink与Arduino串口通信

Principle and practice of common defects in RSA encryption application

【兴趣阅读】Adversarial Filtering Modeling on Long-term User Behavior Sequences for Click-Through Rate Pre

Topological sorting and graphical display of critical path

19.Frambuffer应用编程

Integer type of C language
随机推荐
COMP1721 Creating Classes
VB.net 调用FFmpeg简单处理视频(类库——6)
2022g2 power station boiler stoker special operation certificate examination question bank and answers
Analysis of classical pointer and array written test questions in C language
Graduation design of small programs -- small programs of food and recipes
Useful plug-ins for vscode
[matlab] communication signal modulation general function - low pass filter
Encryption and decryption
[matlab] matlab simulation - simulate the AM modulation process of the modulation system
[matlab] general function of communication signal modulation bandpass filter
Annex III: scoring standard of the defender docx
Zhongke panyun-2022 Guangdong Trojan horse information acquisition and analysis
C语言简易学生管理系统(含源码)
力扣(LeetCode)184. 部门工资最高的员工(2022.07.03)
cmake
Programming example of stm32f1 and stm32subeide -74hc595 drives 4-bit 7-segment nixie tube
Integer type of C language
Nodejs learning document
[matlab] general function of communication signal modulation inverse Fourier transform
Etcd database source code analysis - initialization overview