How to find out the pid of a running program?

Rod Haper haper at ibm.net
Sat Jul 31 12:03:23 EDT 1999


Peter Torstenson wrote:
> 
> I'd like tknow if there is a way of getting the pid of a program running,
> using python commands?

Use the getpid() function from the posix module which is imported
automatically when you import the os module.  Don't import the posix
module directly.  Do it via the os module since this will afford you
code better portablility.  Refer to the Python Library Reference for
more info.




More information about the Python-list mailing list