From ffe64385762b91d9548777b165a4120f3ff2eccd Mon Sep 17 00:00:00 2001 From: Satwik Kansal Date: Sun, 21 Jul 2019 18:57:01 +0530 Subject: [PATCH] Commit insert_ids script --- irrelevant/insert_ids.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 irrelevant/insert_ids.py diff --git a/irrelevant/insert_ids.py b/irrelevant/insert_ids.py new file mode 100644 index 0000000..a16bf5f --- /dev/null +++ b/irrelevant/insert_ids.py @@ -0,0 +1,24 @@ +import uuid + +new_file = [] +original_file = [] + +fname = "../README.md" + + +def generate_random_id_comment(): + random_id = uuid.uuid4() + return f"" + + +with open(fname, "r") as f: + original_file = f.readlines() + + +for line in original_file: + new_file.append(line) + if line.strip().startswith("### "): + new_file.append(generate_random_id_comment()) + +with open(fname, "w") as f: + f.write("".join(new_file))