import repattern = re.compile("^cpu MHz\s*:\s*(?P.+)$", re.M)for line in open('/proc/cpuinfo'): match = pattern.search(line) if match: return 'Cpu: %.1f GHz' % (float(match.group('cpu_frequency').strip()) / 1000)
沒有留言:
張貼留言