-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathday.py
executable file
·48 lines (35 loc) · 960 Bytes
/
day.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/python3
from sys import argv
day = argv[1]
template = \
f"""DEBUG = 1
N = [line.strip() for line in open('./in/{day}.test.txt').readlines()]
# N = [line.strip() for line in open('./in/{day}.txt').readlines()]
def part_1():
pass
def part_2():
pass
if __name__ == '__main__':
print('--- Part 1 ---')
print(part_1())
print('\\n--- Part 2 ---')
print(part_2())
"""
def buffer_in():
buffer = []
while True:
try:
line = input()
buffer.append(line)
except EOFError:
break
return "\n".join(buffer)
if __name__ == "__main__":
print(f"Enter test data for day {day}, then CTRL+D:")
with open(f'./in/{day}.test.txt', 'w+') as f:
f.write(buffer_in())
print(f"Enter real data, then CTRL+D:")
with open(f'./in/{day}.txt', 'w+') as f:
f.writelines(buffer_in())
with open(f'./{day}.py', 'w+') as f:
f.write(template)