-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
34 lines (24 loc) · 965 Bytes
/
Copy pathtest.py
File metadata and controls
34 lines (24 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
import sys
import subprocess
folder_dir = int(sys.argv[1])
dst_path = "%s%05d/%05d/" % ("/Users/kadragon/Dev/acmicpc_python/",
(folder_dir//1000)*1000, folder_dir)
print("=========================================")
i = 1
while True:
input_data, output_data = "", ""
if os.path.exists(dst_path + "_input%d.txt" % (i)):
with open(dst_path + "_input%d.txt" % (i), "r") as f:
input_data = f.read()
with open(dst_path + "_output%d.txt" % (i), "r") as f:
output_data = f.read()
result = subprocess.run(["python3", dst_path + "main.py"],
input=input_data, encoding="utf-8", stdout=subprocess.PIPE)
if result.stdout != output_data:
print("결과\n" + result.stdout)
print("정답\n" + output_data, end="")
print("=========================================")
else:
break
i += 1