How to send a var to stdin of an external software

Sion Arrowsmith siona at
Thu Mar 13 15:21:37 CET 2008

Benjamin Watine  <watine at> wrote:
>How can I do this ? I would like a function like that :
>	theFunction ('cat -', stdin=myVar)
>I don't need to get any return value. says this is spelt

myVar = subprocess.Popen(["cat", "-"], stdout=subprocess.PIPE).communicate()[0]

(Probably not obvious how to find this if you've not come across the
backtick notation in shell or Perl.)

\S -- siona at --
   "Frankly I have no feelings towards penguins one way or the other"
        -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump

More information about the Python-list mailing list