title: Execute Commands Sequentially in Python?
body: <p>I would like to execute multiple commands in a row:</p>
  
  <p>i.e. (just to illustrate my need):</p>
  
  <p><code>cmd</code> (the shell)</p>
  
  <p>then</p>
  
  <p><code>cd dir</code></p>
  
  <p>and</p>
  
  <p><code>ls</code></p>
  
  <p>and read the result of the <code>ls</code>.</p>
  
  <p>Any idea with <code>subprocess</code> module?</p>
  
  <p><strong>Update:</strong></p>
  
  <p><code>cd dir</code> and <code>ls</code> are just an example. I need to run complex commands (following a particular order, without any pipelining). In fact, I would like one subprocess shell and the ability to launch many commands on it.</p>