How to send a var to stdin of an external software

Sion Arrowsmith siona at chiark.greenend.org.uk
Thu Mar 13 15:21:37 CET 2008


Benjamin Watine  <watine at cines.fr> 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.

http://docs.python.org/lib/node534.html 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 chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
   "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