其他分享
首页 > 其他分享> > 杂乱知识点加深印象

杂乱知识点加深印象

作者:互联网

 

 

(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'))

 

标签:知识点,obj,stdout,res,subprocess,PIPE,加深,杂乱,print
来源: https://www.cnblogs.com/OUYANGjt/p/14645251.html