Python os.cpu_count() Method
Example
Find the number of CPUs in the system:
#Import os Library
import os
#Print the number of CPUs
print("Number of CPUs in the system:", os.cpu_count())
Try it Yourself »
Definition and Usage
The os.cpu_count()
method returns the number of CPUs
present in the system.
Syntax
os.cpu_count()
Technical Details
Return Value: | An int value, representing the number of CPUs in the system.
Returns None if the number of CPUs is undetermined |
---|---|
Python Version: | 3.4 |