From 7aa931a3fc29a81d6b558a057a35e1fc7f3eddf4 Mon Sep 17 00:00:00 2001 From: daviddoji Date: Fri, 6 Aug 2021 10:08:12 +0200 Subject: [PATCH] WIP --- src/update_results_table.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/update_results_table.py b/src/update_results_table.py index 94a84dc..7a2a965 100644 --- a/src/update_results_table.py +++ b/src/update_results_table.py @@ -2,4 +2,38 @@ def update_table(): """ Update README.md with the timings of the solved problems """ + text = read() + print(text) + +def read(): + """ + Read README.md + """ + with open("../README.md", "r") as f: + text = [line.strip() for line in f.readlines() if line.strip() != ""] + return text[-1:] + +def write(): + """ + Write to README.md + """ pass + +def execute(num): + """ + Execute script and return output + """ + import sys + sys.path.insert(0, "./Python/") + + import Problem001 + + res = eval(f"Problem{num:0>3}.compute()") + print(res) + time = str(res).split(sep=" ") + print(time) + + +if __name__ == "__main__": + # update_table() + execute(1) \ No newline at end of file