get process id...

billie gnewsg at gmail.com
Thu Sep 21 11:15:35 EDT 2006


Fredrik Lundh ha scritto:

> billie wrote:
>
> >> under linux, do:
>  >
> >>   import os
> >>   os.getpid()
> >
> > Under Windows:
>  >
> > import ctypes
> > ctypes.windll.kernel32.GetCurrentProcessId()
>
> getpid() works just fine on Windows too:
>
>  >>> import ctypes
>  >>> ctypes.windll.kernel32.GetCurrentProcessId()
> 1916
>  >>> import os
>  >>> os.getpid()
> 1916

I tought it doesn't work. Good




More information about the Python-list mailing list