tengo esto:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
ruta = subprocess.Popen(&quot;hostname&quot;, stdout=subprocess.PIPE)<br>
resultado = ruta.communicate()[0]<br>
<br>
se que el resultado de salida lo almacena en result, pero como ejecutar un comando que contenga el caracter &quot;|&quot; por ejemplo este --&gt; &quot;ps auxww | grep postgres: | sort -k 9&quot;, se que incluso puedo hacer esto:<br>

<br>
ruta = subprocess.Popen(&quot;ls&quot;, &quot;-l&quot;, stdout=subprocess.PIPE)<br>
resultado = ruta.communicate()[0]<br>
<br>
pero como decía anteriormente quisiera ejecutar este comando &quot;ps auxww | grep postgres: | sort -k 9&quot; como lo hago con &quot;hostname&quot; y &quot;ls&quot; &quot;-l&quot; ...<br><br></blockquote><div><br>No entiendo muy bien lo que quieres hacer:<br>
<i>pero como decía anteriormente quisiera ejecutar este comando &quot;ps auxww |
 grep postgres: | sort -k 9&quot; como lo hago con &quot;hostname&quot; y &quot;ls&quot; &quot;-l&quot; ...<br></i>pero quizá lo siguiente te pueda ayudar:<br><a href="http://docs.python.org/library/subprocess.html#replacing-shell-pipeline">http://docs.python.org/library/subprocess.html#replacing-shell-pipeline</a><br>
 <br></div></div>