python_reader.py 文件源码

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

项目:pyrepl 作者: dajose 项目源码 文件源码
def interact(self):
        while 1:
            try: # catches EOFError's and KeyboardInterrupts during execution
                try: # catches KeyboardInterrupts during editing
                    try: # warning saver
                        # can't have warnings spewed onto terminal
                        sv = warnings.showwarning
                        warnings.showwarning = eat_it
                        l = unicode(self.reader.readline(), 'utf-8')
                    finally:
                        warnings.showwarning = sv
                except KeyboardInterrupt:
                    print("KeyboardInterrupt")
                else:
                    if l:
                        self.execute(l)
            except EOFError:
                break
            except KeyboardInterrupt:
                continue
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号