-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_new_day.py
More file actions
36 lines (31 loc) · 910 Bytes
/
create_new_day.py
File metadata and controls
36 lines (31 loc) · 910 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
35
36
import os
import sys
if len(sys.argv) < 2:
print("Please give a year and a day")
else:
year = int(sys.argv[1])
day = int(sys.argv[2])
directory = f"{year}/day{day}"
input_dir = f"{directory}/input"
os.makedirs(directory)
os.makedirs(input_dir)
input_path = f"{input_dir}/input.txt"
small_input_path = f"{input_dir}/smallinput.txt"
day_part_one = f"{directory}/day{day}.py"
day_part_two = f"{directory}/day{day}part2.py"
outline_path = f"{directory}/puzzle_outline.txt"
with open(input_path, 'x') as f:
print(f"{input_path} created!")
f.close()
with open(small_input_path, 'x') as f:
print(f"{small_input_path} created!")
f.close()
with open(day_part_one, 'x') as f:
print(f"{day_part_one} created!")
f.close()
with open(day_part_two, 'x') as f:
print(f"{day_part_two} created!")
f.close()
with open(outline_path, 'x') as f:
print(f"{outline_path} created!")
f.close()