def getMemCpu(self): data = psutil.virtual_memory() total = data.total # Total memory , Unit is byte free = data.available # Memory can be memory = "Memory usage:%d" % (int(round(data.percent))) + "%" + " " cpu = "CPU:%0.2f" % psutil.cpu_percent(interval=1) + "%" return memory + cpu