cannot test with your exact commands but that works fine:
import subprocess
process = subprocess.Popen('cmd.exe', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None, shell=True)
o,e = process.communicate(b"dir\n")
print(o)
(I get the contents of my directory)
so for your example, you're missing the line terminators when sending commands. The commands aren't issued to the cmd program, the pipe is broken before that.
That would work better:
import subprocess
process = subprocess.Popen('cmd.exe', stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None)
process.stdin.write(b"adb shell uninstall com.q.q\n")
process.stdin.write(b"adb shell install C:\\...\\qwerty.apk\n")
o,e = process.communicate()
but this is a very strange way to run commands. Just use check_call, with args split properly:
subprocess.check_call(["adb","shell","uninstall","com.q.q"])
subprocess.check_call(["adb","shell","install",r"C:\...\qwerty.apk"])