File object wrapper for a String?
lists at cheimes.de
Fri Feb 15 00:07:27 CET 2008
David Erickson wrote:
> I am using the Popen class from subprocess and would like to feed a
> string in as the stdin parameter, however primarily it only takes a
> File object. Does there exist a wrapper for a string to do this? I
> know I can just dump the string to a temp file and feed that in but
> that is pretty hacky.
You don't need a file like object:
popen = subprocess.Popen(..., stdin=subprocess.PIPE)
More information about the Python-list