In Python, what is the best way to execute a local Linux command stored in a string?
<p>In Python, what is the simplest way to execute a local Linux command stored in a string while catching any potential exceptions that are thrown and logging the output of the Linux command and any caught errors to a common log file? </p>

<pre><code>String logfile = “/dev/log”
String cmd = “ls”
#try
  #execute cmd sending output to &gt;&gt; logfile
#catch sending caught error to &gt;&gt; logfile
</code></pre>
