utility_belt.py 文件源码

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

项目:SQLCell 作者: tmthyjames 项目源码 文件源码
def display(self, columns=[], msg=None):
        data = self.data if len(self.data) <= 100 else self.data[:49] + [['...'] * (len(self.data[0]))] + self.data[-49:]
        table_str = HTMLTable([columns] + data, self.id_)._repr_html_(n_rows=100, length=len(self.data))
        table_str = table_str.replace('<table', '<table class="table-striped table-hover table-bordered"').replace("'", "\\'").replace('\n','')
        display(
            HTML(
                """
                <script type="text/Javascript">
                $('#dbinfo{id}').append('{msg}');
                $('#table{id}').append('{table}');
                </script>
                """.format(msg=str(msg), table=table_str, id=self.id_)
            )
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号