Obtenga un recuento de CPU en Python

1
import os
2
workers = os.cpu_count()
3
if 'sched_getaffinity' in dir(os):
4
    workers = len(os.sched_getaffinity(0))
5
​
Kenggi Peters