def cpu_online_map():
 cpus = []
 for line in open('/proc/cpuinfo', 'r').readlines():
  if line.startswith('processor'):
   cpus.append(line.split()[2])
 return cpus

def cpu_online_map ( ) : cpus = [ ] for line in open ( '/proc/cpuinfo' , 'r' ) . readlines ( ) : if line . startswith ( 'processor' ) : cpus . append ( line . split ( ) [ 2 ] ) return cpus
check out the available cpu online map .