ringmaster_presenters.py 文件源码

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

项目:goreviewpartner 作者: pnprog 项目源码 文件源码
def clear_screen(self):
        """Try to clear the terminal screen (if stdout is a terminal)."""
        if self.clear_method is None:
            try:
                isatty = os.isatty(sys.stdout.fileno())
            except Exception:
                isatty = False
            if isatty:
                self.clear_method = "clear"
            else:
                self.clear_method = "delimiter"

        if self.clear_method == "clear":
            try:
                retcode = subprocess.call("clear")
            except Exception:
                retcode = 1
            if retcode != 0:
                self.clear_method = "newlines"
        if self.clear_method == "newlines":
            print "\n" * (self.screen_height()+1)
        elif self.clear_method == "delimiter":
            print 78 * "-"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号