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)
评论列表
文章目录