Skip to content

Instantly share code, notes, and snippets.

@u1and0
Created June 7, 2019 01:29
Show Gist options
  • Select an option

  • Save u1and0/72152b1d42ea86eb4c2d9e791adfeaec to your computer and use it in GitHub Desktop.

Select an option

Save u1and0/72152b1d42ea86eb4c2d9e791adfeaec to your computer and use it in GitHub Desktop.
go kicks python command as external command
#!/usr/bin/env python
from random import randint
r = 'hello! '
r += str(randint(0,100))
print(r)
with open('written.txt', 'a') as f:
f.writelines( '\n' + str(r))
package main
import (
"os/exec"
)
func main() {
cmd := exec.Command("python", "echo_random.py")
x := 0
for x < 10 {
x++
cmd.Run()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment