当前位置:网站首页>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边栏推荐
- [high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
- Trie number dictionary tree
- LM小型可编程控制器软件(基于CoDeSys)笔记二十二:错误4268/4052
- Encryption and decryption
- Zhongke panyun-d module analysis and scoring standard
- [matlab] general function of communication signal modulation bandpass filter
- [wechat applet] template and configuration (wxml, wxss, global and page configuration, network data request)
- 【QT】制作MyComboBox点击事件
- 企业级日志分析系统ELK(如果事与愿违那一定另有安排)
- 如何使用postman实现简单的接口关联【增删改查】
猜你喜欢

Letter meaning and parameter abbreviation of optical module Daquan

2022 Guangdong provincial competition - code information acquisition and analysis flag

VB.net GIF(制作、拆解——优化代码,类库——5)

Topological sorting and graphical display of critical path

RSA加密应用常见缺陷的原理与实践
![[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk](/img/b9/cf4db4f8a5d2ef3fb344258f0e30f5.jpg)
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk

数据标注是一块肥肉,盯上这块肉的不止中国丨曼孚科技

全国职业院校技能大赛(中职组)网络安全竞赛试题—解析

Simple g++ and GDB debugging

C language simple student management system (including source code)
随机推荐
VB.net GIF(制作、拆解——优化代码,类库——5)
2022g2 power station boiler stoker special operation certificate examination question bank and answers
JS string splicing enhancement
2022 Guangdong provincial competition - code information acquisition and analysis flag
[matlab] communication signal modulation general function interpolation function
Trie number dictionary tree
Ping port artifact psping
中科磐云—2022广东木马信息获取解析
LabVIEW错误对话框的出现
简易零钱通
[high concurrency, high performance and high availability of massive data MySQL practice-7] - memory data drop disk
Unity2D--人物移动并转身
c语言经典指针和数组笔试题解析
企业级日志分析系统ELK(如果事与愿违那一定另有安排)
Integer type of C language
TCP state transition diagram
Two sides of the evening: tell me about the bloom filter and cuckoo filter? Application scenario? I'm confused..
Secondary vocational group network security - memory Forensics
Li Kou's 300th weekly match
cmake