CmdNew.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:zpy 作者: albertaleksieiev 项目源码 文件源码
def cmdloop(self):

        history_location = os.path.join(os.path.dirname(os.path.abspath(__file__)),".history")
        history = FileHistory(history_location)

        print(frontend_message.get_welcome_message())
        while True:
            try:
                while True:
                    text = prompt(self.prompt, lexer=PythonLexer,
                                  completer=self.completer,
                                  style=DocumentStyle, history=history)
                    res = self.processor.forward(text)

                    if(isinstance(res, str)):
                        res = res.strip()
                        if(len(res)>0):
                            print(res)
                    elif res is not None:
                        print(res)


            except KeyboardInterrupt as ex:
                print("^C")
            except EOFError:
                print(frontend_message.get_bye_message())
                break
            except Exception as ex:
                print(ex)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号