How to replace data within a external text file? Python 3.4
Code:
data = {
"PLAYER":name,
"STRENGTH": strength,
...
}
with open("data1.txt", "w", encoding="utf-8") as file:
file.write(repr(data))
file.close()
I am using this to write in to a external file "data1.txt" but what happen if want to change or replace for example 'STRENGTH:' after a certain action..
So if the output file is ORIGNALLY {'STRENGTH': '100'}... how do i change or replace the value of 100 to a different number?
The data is in string format.