>>> 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? '
#open you cmd and there type py
C:Usersacer>py
Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:04:45) [MSC v.1900 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>># Now start coding on cmd
>>>print("Python is easy")
>>>#type exit when you are done coding on cmd
>>> exit()
C:Usersacer>