Skip to content

Instantly share code, notes, and snippets.

@cftang0827
Created July 19, 2020 08:38
Show Gist options
  • Save cftang0827/18f8e6d7ba9150b50722ae36739f7d49 to your computer and use it in GitHub Desktop.
Save cftang0827/18f8e6d7ba9150b50722ae36739f7d49 to your computer and use it in GitHub Desktop.
import argparse
import os
parser = argparse.ArgumentParser()
parser.add_argument("html")
args = parser.parse_args()
with open(os.path.join(".", args.html)) as f:
texts = f.readlines()
with open(os.path.join(".", "output.html"), "w") as f:
f.writelines("<html>\n<div>")
for t in texts:
f.writelines(t.replace("\n", "<br>"))
f.writelines("</div>\n</html>")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment