CLI_helper.py 文件源码

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

项目:competitive-cli 作者: GDGVIT 项目源码 文件源码
def __str__(self):
        if len(self.data["accounts"]) == 0:
            return "There are no accounts set"

        table = prettytable.PrettyTable(["Index", "Website", "Username"])
        list_to_highlight = []

        for keys in self.data["accounts"]:
            if int(keys) == self.account:
                list_to_highlight.append(keys)
            table.add_row([keys] + self.data["accounts"][keys])

        table_string = table.get_string()
        table_list = table_string.split("\n")

        for keys in list_to_highlight:
            table_list[int(keys) + 2] = color.BOLD + table_list[int(keys) + 2] + color.END

        return "\n".join(table_list)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号