os
moduleThe os
module in Python provides functions that help in interacting with the underlying operating system.
Every process is given an integer identifier called process ID or PID.
Note: Click here to learn more about processes in Linux.
getpid()
methodThe getpid()
method returns the PID of the current process in execution.
os.getpid()
The method does not take any argument value.
The method returns the current PID.
import osprint("Process ID of the current process is:", os.getpid())
os
module.os.getpid()
method and print it to the console.