当前位置:网站首页>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边栏推荐
- 如何使用postman实现简单的接口关联【增删改查】
- Topological sorting and graphical display of critical path
- Simulink and Arduino serial port communication
- How to build your own knowledge engine? Community open application
- 光模块字母含义及参数简称大全
- TCP state transition diagram
- Rollup各组件作用
- Just do it with your hands 7 - * project construction details 2 - hook configuration
- [paper summary] zero shot semantic segmentation
- National vocational college skills competition (secondary vocational group) network security competition questions - Analysis
猜你喜欢

Just do it with your hands 7 - * project construction details 2 - hook configuration

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

Public inputs in appliedzkp zkevm (13)

The data mark is a piece of fat meat, and it is not only China Manfu technology that focuses on this meat

中職組網絡安全—內存取證

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

Ping port artifact psping

Download kicad on Alibaba cloud image station

Build an Internet of things infrared temperature measuring punch in machine with esp32 / rush to work after the Spring Festival? Baa, no matter how hard you work, you must take your temperature first

c语言经典指针和数组笔试题解析
随机推荐
Ping port artifact psping
724. 寻找数组的中心下标
[matlab] matlab simulates digital baseband transmission system eye diagram of bipolar baseband signal (class I part response waveform)
Unity is connected to the weather system
The data mark is a piece of fat meat, and it is not only China Manfu technology that focuses on this meat
Encryption and decryption
Zkevm (12) state proof of appliedzkp
Customize a pager needed in your project
Simulated small root pile
Flutter ‘/usr/lib/libswiftCore. dylib‘ (no such file)
Solar insect killing system based on single chip microcomputer
Letter meaning and parameter abbreviation of optical module Daquan
cmake
LabVIEW错误对话框的出现
LM small programmable controller software (based on CoDeSys) note 22: error 4268/4052
2022 a special equipment related management (elevator) examination questions simulation examination platform operation
c语言经典指针和数组笔试题解析
PostgreSQL has officially surpassed mysql. Is this guy too strong!
Etcd database source code analysis - initialization overview
Just do it with your hands 7 - * project construction details 2 - hook configuration