doc:appunti:prog:python_program_execution
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
doc:appunti:prog:python_program_execution [2016/07/28 09:42] – niccolo | doc:appunti:prog:python_program_execution [2017/07/16 06:44] – [Run two commands in a pipe] niccolo | ||
---|---|---|---|
Line 17: | Line 17: | ||
</ | </ | ||
- | Same as above, but run in a subshell: | + | Same as above, but run in a subshell |
<code python> | <code python> | ||
- | retcode = call(" | + | retcode = subprocess.call(" |
</ | </ | ||
Line 59: | Line 59: | ||
output = p2.communicate()[0] | output = p2.communicate()[0] | ||
</ | </ | ||
+ | |||
+ | ===== Write to command standard input ===== | ||
+ | |||
+ | <code python> | ||
+ | cmd_input = [] | ||
+ | cmd_input.append(' | ||
+ | cmd_input.append(' | ||
+ | |||
+ | p = subprocess.Popen(' | ||
+ | p.communicate(os.linesep.join(cmd_input)) | ||
+ | </ | ||
+ |
doc/appunti/prog/python_program_execution.txt · Last modified: 2022/07/01 10:56 by niccolo