def get_cpu_stat(key):
 stats = []
 stat_file = open('/proc/stat', 'r')
 line = stat_file.readline()
 while line:
  if line.startswith(key):
   stats = line.split()[1:]
   break
  line = stat_file.readline()
 return stats

def get_cpu_stat ( key ) : stats = [ ] stat_file = open ( '/proc/stat' , 'r' ) line = stat_file . readline ( ) while line : if line . startswith ( key ) : stats = line . split ( ) [ 1 : ] break line = stat_file . readline ( ) return stats
get load per cpu from /proc/stat :return: list of values of cpu times .