Python Windows 执行cmd命令(popen)

来源:互联网 发布:网络销售管理 编辑:程序博客网 时间:2024/06/06 00:12
import osmystr=os.popen("tasklist")  #popen与system可以执行指令,popen可以接受返回对象mystr=mystr.read() #读取输出print("hello",mystr)if mystr.find("QQ.exe") !=-1:    print("发现QQ")else:    print("QQ已死有事请烧纸")

原创粉丝点击