Steven D'Aprano <[EMAIL PROTECTED]> wrote: > I don't expect that Python will have a built-in core-counting function. > You would probably need to ask the operating system. On Linux, you could > do this: > > import os > text = os.popen('cat /proc/cpuinfo').read() > > > How you would do it in Windows or Mac, I have no idea. >
One way on windows: >>> import win32pdhutil >>> def howmanycores(): for i in range(9999): try: win32pdhutil.GetPerformanceAttributes("Processor(%d)" % i,"% Processor Time") except: break return i >>> print howmanycores() 2 -- Duncan Booth http://kupuguy.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list