import cmdclass PerfShell(cmd.Cmd):intro = 'Welcome to the perf shell. Type help or ? to list commands.\n'prompt = '(perf) 'file = Nonedef do_static_mem_test(self, arg):'静态内存测试'print(arg)def do_bye(self, arg):'Stop recording, close the turtle window, and exit: BYE'print('Thank you for using Turtle')self.close()return True# ----- record and playback -----def do_record(self, arg):'Save future commands to filename: RECORD rose.cmd'self.file = open(arg, 'w')def do_playback(self, arg):'Playback commands from a file: PLAYBACK rose.cmd'self.close()with open(arg) as f:self.cmdqueue.extend(f.read().splitlines())def precmd(self, line): #命令行执行前的钩子函数line = line.lower()if self.file and 'playback' not in line:print(line, file=self.file)return linedef close(self):if self.file:self.file.close()self.file = Noneif __name__ == '__main__':PerfShell().cmdloop()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。