title: Upgrade linux with a python script
body: <p>I want to upgrade my linux system with a python script. But I don't know how to send Y or Enter to the console.</p>
  
  <p>This is my code:</p>
  
  <pre><code>sudo_password = 'password'
  command = 'apt-get update'
  os.system('echo %s|sudo -S %s' % (sudo_password, command))
  command = 'apt-get upgrade'
  os.system('echo %s|sudo -S %s' % (sudo_password, command))
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>I want to run the script automated, therefore I don't want to use raw_input() or input().</p>