>>> import subprocess
>>> proc = subprocess.Popen('cmd.exe', stdin = subprocess.PIPE, stdout = subprocess.PIPE)
>>> stdout, stderr = proc.communicate('dir c:')
>>> stdout
'Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporatio
n. All rights reserved.
C:Python25>More? '