Simplify new script

This commit is contained in:
dece 2020-12-09 13:36:43 +01:00
parent 5bc5c4042e
commit a6e7e49dca

View file

@ -4,9 +4,11 @@ import os
from datetime import date from datetime import date
TEMPLATE = """\ TEMPLATE = """\
import sys
def main(): def main():
with open("{}", "rt") as f: lines = [line.rstrip() for line in sys.stdin]
lines = [line.rstrip() for line in f.readlines()]
if __name__ == "__main__": if __name__ == "__main__":
@ -15,5 +17,5 @@ if __name__ == "__main__":
day = date.today().day day = date.today().day
with open(f"day{day}.py", "wt") as f: with open(f"day{day}.py", "wt") as f:
f.write(TEMPLATE.format(f"day{day}.txt")) f.write(TEMPLATE)
os.system(f"python ../fetch.py {day}") os.system(f"python ../fetch.py {day}")