def getProcessName(pid):
str_pid = str(pid)
process_listing = commands.getoutput('ls /proc').split('\n')
Name = ''
for entry in process_listing:
if entry == str_pid:
try:
filename = '/proc/'+entry+'/status'
fp = open(filename,'r')
stuff=fp.read()
fp.close()
lines = stuff.split('\n')
for line in lines:
if line[:4]=='Name':
Name = line.split(':')[1][1:]
return Name
except:
continue
else:
continue
return Name
test_04_ApplicationFactory.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录