archive

[Python] PID, PPID 구하기 본문

STUDY/Python

[Python] PID, PPID 구하기

seonyounggg 2021. 3. 4. 11:04

현재 실행중인 프로세스의 PID(Process Identification Number)는 os 모듈로 구할 수 있다.

import os

print(os.getpid())

 

PPID(Parent PID)는 psutil 모듈을 통해 얻을 수 있다.

import psutil

psutil.Process(os.getpid()).ppid()

 

'STUDY > Python' 카테고리의 다른 글

[Python] bisect_left, bisect_right  (0) 2021.03.29
[Python] filter() 함수  (0) 2021.03.10
[Python] 문자-아스키코드 변환  (0) 2021.03.02
[Python] with as  (0) 2021.02.24
[Python] zipfile 모듈 사용법  (0) 2021.02.23
Comments