From be2cc4fbc67d7dceb26cea99b3a038c4ef8df0bb Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 12 Oct 2020 22:25:47 +0200 Subject: [PATCH] add a function to create a file --- url2markdown/file.py | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 url2markdown/file.py diff --git a/url2markdown/file.py b/url2markdown/file.py new file mode 100644 index 0000000..960937e --- /dev/null +++ b/url2markdown/file.py @@ -0,0 +1,8 @@ +import markdownify + + +def write_to_file(article, header): + markdown = markdownify.markdownify(article.html) + with open(str(article.title) + ".md", 'a') as f: + f.write(header) + f.write(markdown)