euler/python/lib_create_templates.py

30 lines
510 B
Python
Raw Normal View History

import sys
TEMPLATE = """
def euler_XXX():
return 0
if __name__ == "__main__":
2021-03-23 19:42:57 +01:00
solution = euler_XXX()
print("eXXX.py: " + str(solution))
# assert(solution == 0)
"""
def main():
try:
e = sys.argv[1]
except IndexError:
print("Provide Euler problem number for which to create template.")
return
filename = "e" + e + ".py"
with open(filename, "w") as f:
s = TEMPLATE.replace("XXX", e)
f.write(s)
if __name__ == "__main__":
main()