import otime from rich.console import Console from rich.table import Table def print_runners(Runners): table = Table(title="Runners") table.add_column("Name", justify="right", style="cyan", no_wrap=True) table.add_column("club", style="magenta") table.add_column("card", style="red") table.add_column("class", justify="right", style="green") for i in Runners: table.add_row(i.fullname(), i.club ,str(i.card), i.o_class) console = Console() console.print(table) def print_o_classes(class_list): table = Table(title="Classes") table.add_column("Class", justify="right", style="cyan", no_wrap=True) table.add_column("Course", style="magenta") table.add_column("Controls", justify="right", style="green") for i in class_list: table.add_row(i.name, i.course.name , str(i.course.codes)) console = Console() console.print(table) if __name__ == "__main__": courses = otime.courses_from_ttime_conf('sc_2021_ttime/ttime.cnf.txt') o_classes = otime.classes_from_ttime_conf('sc_2021_ttime/ttime.cnf.txt', courses) Runners = otime.xml_to_class() print_runners(Runners) print_o_classes(o_classes)