chundoong-lab-ta/SamsungDS22/check-submit.py

23 lines
626 B
Python
Raw Normal View History

2022-09-29 18:01:45 +09:00
#!/usr/bin/python3
import os
HWLIST = {
"HW1": ["prob1.txt", "prob2.txt", "main.cpp"],
}
username = os.getenv("USER")
print(f"Username: {username}")
print("------------------------------------")
for (hw,subproblems) in HWLIST.items():
for subproblem in subproblems:
full_path = f"/home/{username}/submit/{hw}/{subproblem}"
status = "OK" if os.path.exists(full_path) else "X file not found"
if os.path.exists(full_path) and os.stat(full_path).st_size == 0:
status = "X empty file"
print(f"{hw} {subproblem}\t: {status}")
print("------------------------------------")