Server!/Horror! I have a magnet and I don't mind using it!

A portable way to find the number of CPUs in Python

This works in Python to get the number of CPUs in a system:

import os
print os.sysconf('SC_NPROCESSORS_CONF')
print os.sysconf('SC_NPROCESSORS_ONLN') # if different that the above this should be used

Generated: 2017-11-02 10:20:47 +0100