python 判斷一個進程是否存在
更新時間:2009年04月09日 12:11:21 作者:
判斷python判斷一個進程是否存在
源代碼如下:
#-*- coding:utf-8 -*-
def check_exsit(process_name):
import win32com.client
WMI = win32com.client.GetObject('winmgmts:')
processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % process_name)
if len(processCodeCov) > 0:
print '%s is exists' % process_name
else:
print '%s is not exists' % process_name
if __name__ == '__main__':
check_exsit('chrome.exe')
復制代碼 代碼如下:
#-*- coding:utf-8 -*-
def check_exsit(process_name):
import win32com.client
WMI = win32com.client.GetObject('winmgmts:')
processCodeCov = WMI.ExecQuery('select * from Win32_Process where Name="%s"' % process_name)
if len(processCodeCov) > 0:
print '%s is exists' % process_name
else:
print '%s is not exists' % process_name
if __name__ == '__main__':
check_exsit('chrome.exe')
相關(guān)文章
Python 實現(xiàn)網(wǎng)課實時監(jiān)控自動簽到、打卡功能
這篇文章主要介紹了Python實現(xiàn)網(wǎng)課實時監(jiān)控自動簽到,打卡功能,本文通過實例代碼給大家介紹的非常詳細,對大家的學習或工作具有一定的參考借鑒價值,需要的朋友可以參考下2020-03-03Python使用pandas導入xlsx格式的excel文件內(nèi)容操作代碼
這篇文章主要介紹了Python使用pandas導入xlsx格式的excel文件內(nèi)容,基本導入是在Python中使用pandas導入.xlsx文件的方法是read_excel(),本文結(jié)合示例代碼給大家介紹的非常詳細,需要的朋友可以參考下2022-12-12Python用requests模塊實現(xiàn)動態(tài)網(wǎng)頁爬蟲
大家好,本篇文章主要講的是Python用requests模塊實現(xiàn)動態(tài)網(wǎng)頁爬蟲,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下2022-02-02Pandas實現(xiàn)數(shù)據(jù)拼接的操作方法詳解
Python處理大規(guī)模數(shù)據(jù)集的時候經(jīng)常需要使用到合并、鏈接的方式進行數(shù)據(jù)集的整合,本文為大家主要介紹了.merge()、?.join()?和?.concat()?三種方法,感興趣的可以了解一下2022-04-04