econ101/start_pset
2024-01-23 20:30:28 -05:00

23 lines
423 B
Python
Executable File

#!/usr/bin/env python3
from string import Template
import os
import sys
import datetime
d = input("What is the due date? ")
i = 1
while os.path.exists(f'pset{i}'):
i += 1
s = {
'number': i,
'date': d
}
with open(f'.template/template.tex', 'r') as f:
src = Template(f.read())
result = src.substitute(s)
os.mkdir(f'pset{i}')
with open(f'pset{i}/pset{i}.tex', 'w') as f:
f.write(result)