Python | os.cpu_count() method
OS module in Python provides functions for interacting with the operating system. OS comes under Python’s standard utility modules. This module provides a portable way of using operating system dependent functionality.
os.cpu_count() method in Python is used to get the number of CPUs in the system. This method returns None if number of CPUs in the system is undetermined.
Syntax: os.cpu_count()
Parameter: No parameter is required.
Return Type: This method returns an integer value which denotes the number of CPUs in the system. None is returned if the number of CPUs is undeterminded.
# Python program to explain os.cpu_count() method # importing os module import os # Get the number of CPUs # in the system using # os.cpu_count() method cpuCount = os.cpu_count() # Print the number of # CPUs in the system print("Number of CPUs in the system:", cpuCount) |
Number of CPUs in the system: 4
Recommended Posts:
- class method vs static method in Python
- Python | next() method
- Python | set() method
- Python | os.dup() method
- Python | sympy.sec() method
- Python | os.confstr() method
- Python PIL | Kernel() method
- Python | os.chown() method
- Python | os.fchmod() method
- Python | os.sysconf() method
- Python Dictionary | pop() method
- Python | sympy.S() method
- Python | sympy.Add() method
- Python | os.fchown() method
- Python | os.lchown() method
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



