From bc3fc3de817e6597033632b66ff8204e20876d4e Mon Sep 17 00:00:00 2001 From: John Lu Date: Thu, 18 Jul 2024 04:44:43 -0400 Subject: [PATCH] added empty solution.md finder python program --- .../comp2804/empty_solution_file_finder.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/content/questions/comp2804/empty_solution_file_finder.py diff --git a/src/content/questions/comp2804/empty_solution_file_finder.py b/src/content/questions/comp2804/empty_solution_file_finder.py new file mode 100644 index 00000000..1a9ce70f --- /dev/null +++ b/src/content/questions/comp2804/empty_solution_file_finder.py @@ -0,0 +1,16 @@ +import os + +def find_empty_solution_files(directory): + for root, _, files in os.walk(directory): + for file in files: + if file == 'solution.md': + file_path = os.path.join(root, file) + relative_path = os.path.relpath(file_path, directory) + with open(file_path, 'r', encoding='utf-8') as f: + content = f.read().strip() + if not content: + print(f"Empty file: {relative_path}") + +if __name__ == "__main__": + directory = os.path.dirname(os.path.abspath(__file__)) + find_empty_solution_files(directory)