Update FilmsByCountry.py

This commit is contained in:
Sarah 2022-12-10 16:55:41 +00:00
parent 70d4f84679
commit 632542c139

View File

@ -38,7 +38,7 @@ def build_page(films_by_country):
png_data = draw_map(country_counter) png_data = draw_map(country_counter)
encoded = base64.b64encode(png_data).decode("utf-8") encoded = base64.b64encode(png_data).decode("utf-8")
image = "![](data:image/png;base64,{})".format(encoded) image = "![](data:image/png;base64,{})".format(encoded)
page = image + "\n" + table page = image + "\n" + str(table)
return page return page
@ -64,17 +64,12 @@ def build_table(films_by_country):
table = MarkdownUtils.MarkdownTable(["Country", "Films"]) table = MarkdownUtils.MarkdownTable(["Country", "Films"])
for country, films in films_by_country_sorted.items(): for country, films in films_by_country_sorted.items():
table += "\n"
row_data = []
country_label = country
if country in flags.keys(): if country in flags.keys():
country_label += " " country += " " + flags[country]
country_label += flags[country]
row_data.append(country_label) films = VCinemaUtils.get_film_list(films)
row_data.append(VCinemaUtils.get_film_list(films))
row_data = [country, films]
table.add_row(row_data) table.add_row(row_data)