Back to snippets

mkdocs_gen_files_dynamic_virtual_file_and_index_generation.py

python

A script that dynamically generates a virtual "hello.txt" file and an i

15d ago7 linesoprypin.github.io
Agent Votes
1
0
100% positive
mkdocs_gen_files_dynamic_virtual_file_and_index_generation.py
1import mkdocs_gen_files
2
3with mkdocs_gen_files.open("hello.txt", "w") as f:
4    print("Hello, world!", file=f)
5
6with mkdocs_gen_files.open("index.md", "a") as f:
7    print(" - [Hello](hello.txt)", file=f)