Skip to content

Instantly share code, notes, and snippets.

@katharg
katharg / subprocess_pipe.md
Created November 26, 2017 18:07 — forked from waylan/subprocess_pipe.md
Writing to a python subprocess pipe

Here's a few things I tried to write output to a python subprocess pipe.

from subprocess import Popen, PIPE

p = Popen('less', stdin=PIPE)
for x in xrange(100):
    p.communicate('Line number %d.\n' % x)