change main so it writes the .html file

This commit is contained in:
AntonObersteiner 2024-05-17 20:40:29 +02:00
parent 451802fefa
commit fa5eb87d7f

View file

@ -135,9 +135,28 @@ network = Network(
),
)
if __name__ == "__main__":
for __ in range(200):
def generate_text(number_of_lines = 100):
result = ""
for i in range(200):
emissions, _ = network.choose()
line = ''.join(emissions)
print(line)
result += line + "\n"
return result
def read_template(filename = "./template.html"):
with open(filename, "r") as file:
return file.read()
def write_index(text, filename = "./deploy/index.html"):
with open(filename, "w") as file:
file.write(text)
def main():
template = read_template()
generated = generate_text()
text = template.replace("<replace with text>", generated)
write_index(text)
if __name__ == "__main__":
main()