Reputation: 3364
I want to list all processes' information currently exist in Linux system. I find that someone uses psutil
library to accomplish this task. However, my development environment can only support native Python library. It means that I can't use any external modules.
It there exist a simple way to accomplish this mission?
Thanks.
Upvotes: 0
Views: 200
Reputation: 180401
Not exactly what you are trying to accomplish but linux commands can be run using the subprocess module:
import subprocess
proc = subprocess.Popen("pstree",stdout=subprocess.PIPE)
proc.communicate()[0]
proc = subprocess.Popen(["ps" ,"aux"],stdout=subprocess.PIPE)
proc.communicate()[0]
Upvotes: 1