Python Forum

Full Version: open, read and replace a string in a file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,
i want to read a file, and replace a certain value.

i don t know the exact string value but i know what is before and after this value

for optimization reason i want to open the file only one time.

any help please?

example of file :

{"azure": {"ENDPOINT":"another sms", "DB_NAME": "db",}
so the value i want to replace here is another sms, and i know that before it, i have "ENDPOINT":" and after it i have ",

how can i do it please