-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added empty solution.md finder python program
- Loading branch information
1 parent
6e8346c
commit bc3fc3d
Showing
1 changed file
with
16 additions
and
0 deletions.
There are no files selected for viewing
16 changes: 16 additions & 0 deletions
16
src/content/questions/comp2804/empty_solution_file_finder.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |