import os os.system(‘services.msc’)AppIDSvc AppMgmt defragsvc f=os.popen(‘sc query AppMgmt’) array=f.read().split(’:’) #STOPPED / RUNNING state=array[3].split(’ ')[3] print(state) if ‘RUNNING’==state: print(‘程序正在运行’) else: print(‘程序已停止’)