def search_in_processes_by_name(process_name):
"""Searches currently running processes and returns a list of psutil.Process objects corresponding to processes that
has the str process_name in them
Args:
process_name (str): Name of the process that'll be searched for
Returns:
list: List of psutil.Process objects corresponding to the filtered processes
"""
processlist = []
for p in psutil.process_iter():
if re.search(process_name, p.name(), re.IGNORECASE):
processlist.append(p)
return processlist
#:tag:Processes
评论列表
文章目录