change main so it writes the .html file
This commit is contained in:
parent
451802fefa
commit
fa5eb87d7f
1 changed files with 23 additions and 4 deletions
27
generate.py
27
generate.py
|
@ -135,9 +135,28 @@ network = Network(
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def generate_text(number_of_lines = 100):
|
||||||
if __name__ == "__main__":
|
result = ""
|
||||||
for __ in range(200):
|
for i in range(200):
|
||||||
emissions, _ = network.choose()
|
emissions, _ = network.choose()
|
||||||
line = ''.join(emissions)
|
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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue