Python设置windows进程的优先级,python优先级,下面的方法可以设置win
Python设置windows进程的优先级,python优先级,下面的方法可以设置win
下面的方法可以设置windows进程的优先级,默认情况会设置当前进程的优先级,你可以通过传进程id参数来设定任何一个存在进程的优先级。
def setpriority(pid=None,priority=1): """ Set The Priority of a Windows Process. Priority is a value between 0-5 where 2 is normal priority. Default sets the priority of the current python process but can take any valid process ID. """ import win32api,win32process,win32con priorityclasses = [win32process.IDLE_PRIORITY_CLASS, win32process.BELOW_NORMAL_PRIORITY_CLASS, win32process.NORMAL_PRIORITY_CLASS, win32process.ABOVE_NORMAL_PRIORITY_CLASS, win32process.HIGH_PRIORITY_CLASS, win32process.REALTIME_PRIORITY_CLASS] if pid == None: pid = win32api.GetCurrentProcessId() handle = win32api.OpenProcess(win32con.PROCESS_ALL_ACCESS, True, pid) win32process.SetPriorityClass(handle, priorityclasses[priority])
相关内容
- Python使用PIL裁剪贴图代码,pythonpil贴图代码,Python使用
- python通过HTMLParser抓取网页上的全部链接,pythonhtmlpars
- python压缩和读取.tar.bz2格式的压缩包,python.tar.bz2,#压缩
- webpy输出json例子代码,webpy输出json,webpy中可以方便的输
- python的反射:动态获得模块,类,python模块,python的反射
- python使用urllib2抓取网页时的错误处理,pythonurllib2,try
- python计算代码执行时间,python计算代码,import times
- python使用xmlproc验证xml格式是否符合DTD定义,xmlprocdtd,
- python线程池实现,python线程池,python原生包中没有
- python的SIGIO handler,sigiohandler,On Linux, us
评论关闭