Skip to content

Commit

Permalink
Create replace_placeholders.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NastLen authored Dec 23, 2023
1 parent cee0b19 commit 3e82818
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions replace_placeholders.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# replace_placeholders.py

def replace_fact_placeholder(file_path, random_fact):
with open(file_path, "r", encoding="utf-8") as file:
content = file.read()

updated_content = content.replace("[Random Animal Fact]", random_fact)

with open(file_path, "w", encoding="utf-8") as file:
file.write(updated_content)

if __name__ == "__main__":

replace_fact_placeholder("Second_Post.md", random_fact)
replace_fact_placeholder("third.md", random_fact)
replace_fact_placeholder("fourth.md", random_fact)

0 comments on commit 3e82818

Please sign in to comment.