use os.popen("your cmd here")<br><br><div class="gmail_quote">On Sun, Mar 16, 2008 at 8:06 PM, Luke Paireepinart <<a href="mailto:rabidpoobear@gmail.com">rabidpoobear@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">shawn bright wrote:<br>
> Lo there all,<br>
><br>
> I am needing to get a response back from a system command.<br>
> i can do this:<br>
><br>
> os.system('mailq | wc -l")<br>
><br>
> if i do this in the terminal mailq | wc -l , it will spit out a number.<br>
> How do i get that number as a python variable ?<br>
</div>You need to use the subprocess module, specifically subprocess.Popen, to<br>
open an input pipe from the command so you can read() the data in.<br>
<div><div></div><div class="Wj3C7c"><br>
_______________________________________________<br>
Tutor maillist - <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</div></div></blockquote></div><br>