I\'m trying to open a text file and then read through it replacing certain strings with strings stored in a dictionary.
Based on answers to How do I edit a text file
If You are more familiar with Python, You can use tips from Official documentation:
7.1. string — Common string operations
And subclass, the Template class, in which you define somehow that every single world will be a new placeholder, and then with safe_substitute()
You could get a nice and reliable solution.