User Tools

Site Tools


doc:appunti:prog:python_program_execution

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
doc:appunti:prog:python_program_execution [2017/01/13 12:14] – [Run a command] niccolodoc:appunti:prog:python_program_execution [2017/07/16 06:44] – [Run two commands in a pipe] niccolo
Line 59: Line 59:
 output = p2.communicate()[0] output = p2.communicate()[0]
 </code> </code>
 +
 +===== Write to command standard input =====
 +
 +<code python>
 +cmd_input = []
 +cmd_input.append('line input one')
 +cmd_input.append('line input two')
 +
 +p = subprocess.Popen('command', stdin=subprocess.PIPE)
 +p.communicate(os.linesep.join(cmd_input))
 +</code>
 +
doc/appunti/prog/python_program_execution.txt · Last modified: 2022/07/01 10:56 by niccolo