(win下)tacklist===ps aux(unix查看进程)
json转化完是字符串类型pickle同理
# import subprocess #规定是以字符串形式写入False的话是列表 换行符什么的 # obj=subprocess.Popen('python',stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.PIPE,universal_newlines=True) # # res=obj.communicate(print('123')) #直接返回值 # obj.stdin.write("print('123')") # obj.stdin.close() # # # res=obj.stdout.read() # obj.stdout.close() # res2=obj.stderr.read() # obj.stdout.close() # print(res) # print(res2) import subprocess obj=subprocess.Popen('tasklist',shell=True,stdout=subprocess.PIPE,stderr=subprocess.PIPE) res=obj.stdout.read() res2=obj.stderr.read() print(res.decode('gbk')) print(res2.decode('gbk'))