How can I check nbr of cores of computer?

Mensanator mensanator at aol.com
Wed Jul 30 02:44:41 CEST 2008


On Jul 29, 5:53 pm, defn noob <circularf... at yahoo.se> wrote:
> How can I check how many cores my computer has?
> Is it possible to do this in a Python-app?

If you're using Windows, get PyWin32:

win32api.GetSystemInfo
tuple = GetSystemInfo()

Retrieves information about the current system.

Win32 API References

Search for GetSystemInfo at msdn, google or google groups.

Return Value
The return value is a tuple of 9 values,
which corresponds to the Win32 SYSTEM_INFO structure.
The element names are:
dwOemId
dwPageSize
lpMinimumApplicationAddress
lpMaximumApplicationAddress
dwActiveProcessorMask
dwNumberOfProcessors
dwProcessorType
dwAllocationGranularity
(wProcessorLevel,wProcessorRevision)


>>> import win32api
>>> win32api.GetSystemInfo()
(0, 4096, 65536, 2147418111, 3L, 2, 586, 65536, (6, 3846))
                                 |
                                 processors




More information about the Python-list mailing list