diff --git a/PyPI/setup.cfg b/PyPI/setup.cfg index 26379f4..a696e8f 100644 --- a/PyPI/setup.cfg +++ b/PyPI/setup.cfg @@ -1,7 +1,7 @@ [metadata] # replace with your username: name = guan -version = 0.1.120 +version = 0.1.121 author = guanjihuan author_email = guanjihuan@163.com description = An open source python package diff --git a/PyPI/src/guan.egg-info/PKG-INFO b/PyPI/src/guan.egg-info/PKG-INFO index 6e8676e..424d6cc 100644 --- a/PyPI/src/guan.egg-info/PKG-INFO +++ b/PyPI/src/guan.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: guan -Version: 0.1.120 +Version: 0.1.121 Summary: An open source python package Home-page: https://py.guanjihuan.com Author: guanjihuan diff --git a/PyPI/src/guan/others.py b/PyPI/src/guan/others.py index 2cd25c1..17d41a4 100644 --- a/PyPI/src/guan/others.py +++ b/PyPI/src/guan/others.py @@ -430,16 +430,20 @@ def get_all_functions_in_one_package(package_name='guan', print_show=1): return all_function_names # 获取包含某个字符的进程PID值 -def get_PID(name): +def get_PID_array(name): import subprocess command = "ps -ef | grep "+name result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) if result.returncode == 0: ps_ef = result.stdout import re - ps_ef = re.split(r'\s+', ps_ef) - id_running = ps_ef[1] - return id_running + ps_ef_1 = re.split(r'\n', ps_ef) + id_running_array = [] + for ps_ef_item in ps_ef_1: + if ps_ef_item != '': + ps_ef_2 = re.split(r'\s+', ps_ef_item) + id_running_array.append(ps_ef_2[1]) + return id_running_array # 查找文件名相同的文件 def find_repeated_file_with_same_filename(directory='./', ignored_directory_with_words=[], ignored_file_with_words=[], num=1000):