2 ms·
There's no problem but if you want to shell out there are a few ways to do it to make sure you're in control of the subshell. At the simplest there's: imp
by fnord123 9y ago
There's no problem but if you want to shell out there are a few ways to do it to make sure you're in control of the subshell.
At the simplest there's:
import os
os.system('command')
Then you might want to capture stdout and stdin or interact with the subshell (e.g. hitting 'y'). So you use:
import subprocess
cmd = subprocess.Popen("cat <(head tmp)", shell=True, stdout=subprocess.PIPE)
stdout, _ = cmd.communicate()
And if you want to timeout or parse logs or whatever, you go from there and it gets more and more complicated. If Julia has solved this then the community should be advertising this above all the alleged performance stuff.