paceboard/scripts/utils/file.py

11 lines
268 B
Python
Raw Normal View History

2021-06-24 00:38:47 +01:00
### Util library for general file handling
def replaceTextInFile(filepath, oldText, newText):
file = open(filepath, "rt")
newFile = file.read().replace(oldText, newText)
file.close()
file = open(filepath, "wt")
file.write(newFile)
file.close