Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我是 python 新手,我正在尝试在 python 字典中重新创建进程层次结构,就像 unix pstree 所做的那样。
不幸的是,我无法使用美妙的 psutil 库,因为我没有权限搜索 /proc 路径。
有人已经做过这个练习了吗?
如果要运行 pstree,可以使用子进程:
from subprocess import check_output out = check_output(["pstree","-u","foo"]) print(out)