Answer the question
In order to leave comments, you need to log in
How to change the mode of working with a file?
The task is as follows: you need to change the data from the file and write it to the same file.
The file is opened like this:
How to change the mode of working with a file without repeating the open () instruction. Or, how to open a file for writing after saving the contents to a string variable? open('file.json', 'r')
Answer the question
In order to leave comments, you need to log in
And you can't open it for reading + writing with the 'r +' parameter?
save - do
data = myfile.read()
and then
newfile.write(data)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question